package com.yuncheng.oaApi.FlowService;


import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.hash.Hash;
import com.yuncheng.oaApi.vo.AgentVo;
import com.yuncheng.oaApi.vo.OaFlowVo;
import com.yuncheng.oaApi.vo.OaReturnVo;
import com.yuncheng.oaApi.vo.Result;
import com.yuncheng.spcyApi.service.ISpcyLogService;
import org.apache.commons.collections.CollectionUtils;
import com.yuncheng.oaApi.utils.GetUuIdUtils;;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yuncheng.oaApi.busService.OaDbrService;
import com.yuncheng.oaApi.busService.OaFlowNodeDbrService;
import com.yuncheng.oaApi.busService.OaFlowNodeService;
import com.yuncheng.oaApi.constant.OaCommonFlowConstant;
import com.yuncheng.oaApi.constant.OaFlowNodeConstant;
import com.yuncheng.oaApi.constant.OaFlowConstant;
import com.yuncheng.oaApi.entity.*;
import com.yuncheng.exception.BusinessException;
import com.yuncheng.oaApi.service.*;
import com.yuncheng.oaApi.service.impl.OaYcSysUserServiceImpl;
import com.yuncheng.spcyApi.utils.DateConvert;
import com.yuncheng.utils.ThreadContextHelper;
import com.yuncheng.vo.*;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import utils.DateConversionUtils;
import utils.LogUtils;
import utils.ObjectToMapUtils;

import javax.annotation.Resource;
import java.lang.reflect.InvocationTargetException;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;

@Component(value = "NewNkyssbFlowService")
public class NewNkyssbFlowService {

    private static final Logger log = LoggerFactory.getLogger(NewNkyssbFlowService.class);

    @Resource
    private IOaSpcySqsxJobService spcySqsxJobService;

    @Resource
    @Lazy
    private OaYcSysUserServiceImpl ycSysUserService;

    @Resource
    @Lazy
    private ISpcyLogService spcyLogService;


    @Resource
    @Lazy
    private IOaSysTzMessageService sysTzMessageService;

    @Resource
    @Lazy
    private IOaSysFlowTempleService sysFlowTempleService;

    @Resource
    @Lazy
    private OaFlowNodeDbrService oaFlowNodeDbrService;

    @Resource
    @Lazy
    private OaFlowNodeService oaFlowNodeService;

    @Resource
    @Lazy
    private IOaSysJobService sysJobService;

    @Resource
    @Lazy
    private IOaSysFlowNodeService sysFlowNodeService;

    @Resource
    @Lazy
    private INkBmysxmsbsplcService nbmysxmsbsplcService;

    @Resource
    @Lazy
    private INkYssbhjService nkYssbhjService;

    @Resource
    @Lazy
    private INkRsBmysxmsbService nkyrsBmysxmsbService;


    @Resource
    @Lazy
    private INkBmysxmsbXmnrService nkBmysxmsbXmnrService;

    @Resource
    @Lazy
    private IOaProcessBusinessService oaProcessBusinessService;


    @Resource
    private IOaSpcySqsxJobService oaSpcySqsxJobService;

    @Resource
    @Lazy
    private INkYssbhjKtService nkYssbhjKtService;

    @Resource
    @Lazy
    private INkYssbhjysService nkYssbhjysService;

    @Resource
    @Lazy
    private INkYssbhjPxService nkYssbhjpxService;


    @Resource
    @Lazy
    private INkYssbjxbjxzbService nkYssbjxzbService;


    @Resource
    @Lazy
    private INkYssbhjjxzbService nkYssbhjjxzbService;




    /**
     * @param oaFlowVo
     * @param nowJob
     * @param jobId
     * @param oaid
     * @param submitType
     * @param opinion
     * @return
     */
    public Result handleFlow(OaFlowVo oaFlowVo, OaJobEntity nowJob, String jobId, String oaid, String submitType, String opinion) {

        // 当前流程任务
        if (StringUtils.isNotBlank(jobId)) {
            nowJob = spcySqsxJobService.getById(jobId);
        }

        if (nowJob == null) {
            return Result.error("当前流程任务不存在，请重试");
        }
        if (StringUtils.isBlank(oaid)) {
            oaid = nowJob.getFpid();
        }

        if (StringUtils.isBlank(oaid)) {
            throw new BusinessException("参数丢失，请联系管理员");
        }


        // 提交按钮
        if (submitType.equals(OaCommonFlowConstant.SUBMIT_TYPE_SUBMIT)) {
            if (nowJob == null) {
                return Result.error("当前流程任务不存在");
            }
        }
        CurrentUserVo currentUser = ThreadContextHelper.getCurrentUser();
        if (currentUser == null) {
            return Result.error("登录已失效，请重新登录");
        }

        NkBmysxmsbsplc nkBmysxmsbsplc = nbmysxmsbsplcService.getById(oaid);
        String lcmbCode = OaFlowConstant.NK_YSSBLC;

        //当前环节办理人名称以及时间
        if (nowJob.getFhjmc().equals(OaFlowConstant.YSSBLC_CWSH_YS)) {

            nkBmysxmsbsplc.setFyscwshrid(currentUser.getId());
            nkBmysxmsbsplc.setFyscwshr(currentUser.getName());
            nkBmysxmsbsplc.setFyscwshyjsj(DateConversionUtils.DateToYMDMM(new Date()));
            nbmysxmsbsplcService.updateById(nkBmysxmsbsplc);


        } else if (nowJob.getFhjmc().equals(OaFlowConstant.YSSBLC_SQ_YS)) {

            nkBmysxmsbsplc.setFysbgsldshrid(currentUser.getId());
            nkBmysxmsbsplc.setFysbgsldshr(currentUser.getName());
            nkBmysxmsbsplc.setFysbgsldshyjsj(DateConversionUtils.DateToYMDMM(new Date()));
            nbmysxmsbsplcService.updateById(nkBmysxmsbsplc);


        } else if (nowJob.getFhjmc().equals(OaFlowConstant.YSSBLC_ZXZRSH_YS)) {
            NkBmysxmsbsplc nkBmysxmsbsplcs = nbmysxmsbsplcService.getById(oaid);

            if (submitType.equals(OaCommonFlowConstant.SUBMIT_TYPE_SUBMIT)) {

                String fyszxldshrValue = nkBmysxmsbsplcs.getFysldbzshr();
                nkBmysxmsbsplcs.setFysldbzshr(StringUtils.isBlank(fyszxldshrValue) ?  currentUser.getName() : fyszxldshrValue + "@@" +  currentUser.getName());
                nkBmysxmsbsplcs.setFyszxldshr("");

                //id
                String fyszxldshridValue = nkBmysxmsbsplcs.getFysldbzshrid();
                nkBmysxmsbsplcs.setFysldbzshrid(StringUtils.isBlank(fyszxldshridValue) ?  currentUser.getId() : fyszxldshridValue + "@@" +  currentUser.getId());
                nkBmysxmsbsplcs.setFyszxldshrid("");



                //意见
                String fyszxldshyjValue = nkBmysxmsbsplcs.getFysldbzshyj();
                nkBmysxmsbsplcs.setFysldbzshyj(StringUtils.isBlank(fyszxldshyjValue) ?  oaFlowVo.getOpinion() : fyszxldshyjValue + "@@" +  oaFlowVo.getOpinion());
                nkBmysxmsbsplcs.setFyszxldshyj("");

                /**
                 * 时间
                 */
                String fyszxldshyjsjValue = nkBmysxmsbsplcs.getFysldbzshyjsj();
                nkBmysxmsbsplcs.setFysldbzshyjsj(StringUtils.isBlank(fyszxldshyjsjValue) ?  DateConversionUtils.DateToYMDMM(new Date()) : fyszxldshyjsjValue + "@@" +  DateConversionUtils.DateToYMDMM(new Date()));
                nkBmysxmsbsplcs.setFyszxldshyjsj("");

            }else {
                nkBmysxmsbsplcs.setFyszxldshrid(currentUser.getId());
                nkBmysxmsbsplcs.setFyszxldshr(currentUser.getName());
                nkBmysxmsbsplcs.setFyszxldshyjsj(DateConversionUtils.DateToYMDMM(new Date()));
                nkBmysxmsbsplcs.setFyszxldshyj("");
            }
            oaFlowVo.getMap().put("fyszxldshyj","");


            nkBmysxmsbsplcs.setFyszxldshyj("");


            nbmysxmsbsplcService.updateById(nkBmysxmsbsplcs);


        } else if (nowJob.getFhjmc().equals(OaFlowConstant.YSSBLC_CWSH_ES)) {

            nkBmysxmsbsplc.setFescwshr(currentUser.getName());
            nkBmysxmsbsplc.setFescwshrid(currentUser.getId());
            nkBmysxmsbsplc.setFescwshyjsj(DateConversionUtils.DateToYMDMM(new Date()));
            nbmysxmsbsplcService.updateById(nkBmysxmsbsplc);


        } else if (nowJob.getFhjmc().equals(OaFlowConstant.YSSBLC_SQ_ES)) {

            nkBmysxmsbsplc.setFesbgsldshr(currentUser.getName());
            nkBmysxmsbsplc.setFesbgsldshrid(currentUser.getId());
            nkBmysxmsbsplc.setFesbgsldshyjsj(DateConversionUtils.DateToYMDMM(new Date()));
            nbmysxmsbsplcService.updateById(nkBmysxmsbsplc);

        }


        // 流程环节处理
        Result httpResult = handleNodeName(oaFlowVo, submitType, nowJob, oaid, opinion);
        if (!httpResult.isSuccess()) {
            return httpResult;
        }
        //最后一步状态标注流程结束
        /**
         * @Author: lhb
         * @Description :  是最后一步流程 且是 提交 才会判断为流程结束
         * @DateTime:
         * @Params:
         */
        String fnodeid = nowJob.getFnodeid();
        boolean endNode = sysFlowNodeService.endNode(fnodeid);

        if (endNode && submitType.equals(OaCommonFlowConstant.SUBMIT_TYPE_SUBMIT)) {
            //当前流程id
            String timeStr = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));

            NkBmysxmsbsplc nkBmysxmsbsplc1 = nbmysxmsbsplcService.getById(oaid);




            if (submitType.equals(OaCommonFlowConstant.SUBMIT_TYPE_SUBMIT)) {
                String feszxldshrValue = nkBmysxmsbsplc1.getFesldbzshr();
                nkBmysxmsbsplc1.setFesldbzshr(StringUtils.isBlank(feszxldshrValue) ?  currentUser.getName() : feszxldshrValue + "@@" +  currentUser.getName());
                nkBmysxmsbsplc1.setFeszxldshr("");

                //id
                String feszxldshridValue = nkBmysxmsbsplc1.getFesldbzshrid();
                nkBmysxmsbsplc1.setFesldbzshrid(StringUtils.isBlank(feszxldshridValue) ?  currentUser.getId() : feszxldshridValue + "@@" +  currentUser.getId());
                nkBmysxmsbsplc1.setFeszxldshrid("");



                //意见
                String feszxldshyjValue = nkBmysxmsbsplc1.getFesldbzshyj();
                nkBmysxmsbsplc1.setFesldbzshyj(StringUtils.isBlank(feszxldshyjValue) ?  oaFlowVo.getOpinion() : feszxldshyjValue + "@@" +   oaFlowVo.getOpinion());
                nkBmysxmsbsplc1.setFeszxldshyj("");

                /**
                 * 时间
                 */
                String feszxldshyjsjValue = nkBmysxmsbsplc1.getFesldbzshyjsj();
                nkBmysxmsbsplc1.setFesldbzshyjsj(StringUtils.isBlank(feszxldshyjsjValue) ?  DateConversionUtils.DateToYMDMM(new Date()) : feszxldshyjsjValue + "@@" +  DateConversionUtils.DateToYMDMM(new Date()));
                nkBmysxmsbsplc1.setFeszxldshyjsj("");

            }else {
                nkBmysxmsbsplc1.setFeszxldshrid(currentUser.getId());
                nkBmysxmsbsplc1.setFeszxldshr(currentUser.getName());
                nkBmysxmsbsplc1.setFeszxldshyjsj(DateConversionUtils.DateToYMDMM(new Date()));
                nkBmysxmsbsplc1.setFeszxldshyj("");
            }
            oaFlowVo.getMap().put("feszxldshyj","");


            nkBmysxmsbsplc1.setFeszxldshyj("");


            nkBmysxmsbsplc1.setFjhzt(OaCommonFlowConstant.YSSBJH_JHWC);
            nkBmysxmsbsplc1.setFlczt(OaCommonFlowConstant.FLOW_LCJS);
            nbmysxmsbsplcService.updateById(nkBmysxmsbsplc1);

            //更新完成后在信息通知表里插入一条消息 表示未读
            sysTzMessageService.endMessage(oaid, false, true, false);

        }

        return Result.ok("操作成功");
    }

    public Result handleNodeName(OaFlowVo oaFlowVo, String submitType, OaJobEntity job, String oaId, String opinion) {
        HashMap<String, Object> map = oaFlowVo.getMap();
        String dbrid = oaFlowVo.getDbrid();// 下环节待办人
        String smgflag = oaFlowVo.getSmgflag(); // 短信发送标志
        boolean isSubmit = true; // 是否提交流程
        Result res = null;

        // 保存按钮
        if (submitType.equals(OaCommonFlowConstant.SUBMIT_TYPE_SAVE)) {
            updateSqsxJbxx(map, oaId, job);
        }

        // 提交按钮
        if (submitType.equals(OaCommonFlowConstant.SUBMIT_TYPE_SUBMIT)) {
            updateSqsxJbxx(map, oaId, job);

            // 流程任务id
            String jobId = "";
            if (job != null) {
                jobId = job.getId();
            }

            String nextNodeId = "";
            if (StringUtils.isNotBlank(oaFlowVo.getNextNodeId())) {
                nextNodeId = oaFlowVo.getNextNodeId();
            }

            // 提交流程任务,待办人是否为空，指定待办人
            if (isSubmit) {
                if (StringUtils.isBlank(dbrid)) {
                    // 提交-流程任务

                    res = passJob(oaId, jobId, opinion, nextNodeId, "");
                } else {
                    // 提交-流程任务
                    res = passJob(oaId, jobId, opinion, nextNodeId, dbrid);
                }
            }
            if (!res.isSuccess()) {
                return res;
            } else {
                OaJobEntity nowJob = (OaJobEntity) res.getResult();
                // 接收返回的流程任务，如果返回的流程任务id不相等，发送短信
                if (nowJob != null && !jobId.equals(nowJob.getId()) && StringUtils.isNotBlank(smgflag) && smgflag.equals("是")) {

                }
            }
        }

        return Result.ok("提交成功");
    }


    public Result updateSqsxJbxx(HashMap<String, Object> map, String oaid, OaJobEntity job) {
        NkBmysxmsbsplc oldBasic = nbmysxmsbsplcService.getById(oaid);
        if (oldBasic == null) {
            return Result.error("当前申请事项【" + oaid + "】不存在，请重试");
        }
        NkBmysxmsbsplc basicUpdate = null;
        basicUpdate = oldBasic;

        // 修改
        ConvertUtils.register(new DateConvert(), java.util.Date.class);
        try {
            BeanUtils.populate(basicUpdate, map);
            nbmysxmsbsplcService.updateById(basicUpdate);
        } catch (IllegalAccessException e) {
            log.error("出错-保存申请事项【非法访问异常】,{}", e.getMessage());
        } catch (InvocationTargetException e) {
            log.error("出错-保存申请事项【调用TargetException】,{}", e.getMessage());
        }

        String logContent = "基本信息修改: ";
        Map<String, Object> basicMap = ObjectToMapUtils.objectToMap(oldBasic);
        logContent += LogUtils.BeanModifyMsg(basicUpdate, basicMap);

        if (job == null) {
            spcyLogService.addLogs("null", logContent, oaid, OaCommonFlowConstant.LOGS_SYS_TYPE_XG, OaCommonFlowConstant.LOGS_SYS_TYPE_XG);
        } else {
            spcyLogService.addLogs(job.getFhjmc(), logContent, oaid, OaCommonFlowConstant.LOGS_SYS_TYPE_XG, OaCommonFlowConstant.LOGS_SYS_TYPE_XG);
        }

        return Result.ok("保存成功");
    }

    public Map getJobConcernByJobId(String jobid) {
        CurrentUserVo currentUser = ThreadContextHelper.getCurrentUser();
        Map map = new HashMap();

        // 当前流转记录
        OaJobEntity job = spcySqsxJobService.getById(jobid);
        if (job == null) {
            log.error("当前流程任务id为【{}】的流转记录不存在", jobid);
            return map;
        }
        String oaid = job.getFpid();
        if (org.apache.commons.lang3.StringUtils.isBlank(oaid)) {
            log.error("当前流程任务id为【{}】的流转记录中的申请事项id为空", jobid);
            return map;
        }
        // oaid事项基本信息
        NkBmysxmsbsplc nkBmysxmsbsplc = nbmysxmsbsplcService.getById(oaid);

        // 流程任务流传记录
        List<OaJobEntity> jobList = this.getJobListByOaId(oaid);
        String nextNode = "";
        String nextNodeId = "";

        String fnodeid = job.getFnodeid();
        //判断当前是否是最后一个节点 如果是 返回当前查询
        if (sysFlowNodeService.endNode(fnodeid)) {
            List<OaSysFlowNode> nowNode = sysFlowNodeService.getNowNode(fnodeid);
            nextNode = nowNode.get(0).getFjdmc();
            nextNodeId = nowNode.get(0).getId();
        } else {
            List<OaSysFlowNode> nextNode1 = sysFlowNodeService.getNextNode(fnodeid);
            nextNode = nextNode1.get(0).getFjdmc();
            nextNodeId = nextNode1.get(0).getId();
        }
        // 获取下环节待办人
        Map nodeDbrids = oaFlowNodeService.getNodeDbrids(nextNodeId, jobid);

        List<AgentVo> dbrListByMap = oaFlowNodeDbrService.getDbrListByMap(nodeDbrids);

        map.put("sqsx", nkBmysxmsbsplc); // 申请事项基本信息
        map.put("job", job); // 当前流转记录
        map.put("jobHistoryList", jobList); // 流程任务流传记录
        map.put("nextNodeDbrList", dbrListByMap); // 下环节待办人list
        map.put("nextNode", nextNode);

        return map;
    }

    /**
     * 获取oa-流转记录
     */
    public List<OaJobEntity> getJobListByOaId(String oaid) {
        String flcmbbm = OaFlowConstant.OA_JBZB;
        List<OaSysFlowTemple> list = sysFlowTempleService.list(new LambdaQueryWrapper<OaSysFlowTemple>().eq(OaSysFlowTemple::getFlcbm, flcmbbm));
        String flcmc = list.get(0).getFlcmc();
        LambdaQueryWrapper<OaJobEntity> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.like(OaJobEntity::getFlcmc, flcmc);
        queryWrapper.eq(OaJobEntity::getFpid, oaid);
        queryWrapper.orderByAsc(OaJobEntity::getCreateTime);
        queryWrapper.orderByAsc(OaJobEntity::getFfssj);
        List<OaJobEntity> jobList = spcySqsxJobService.list(queryWrapper);
        return jobList;
    }

    /**
     * @param lcmbCode    流程模板编码
     * @param oaid        业务id
     * @param currentUser 当前登陆用户
     * @return
     */
    public Result createProcess(String lcmbCode, String oaid, CurrentUserVo currentUser) {
        //获取流程模板的第一个环节
        OaSysFlowTemple code = sysFlowNodeService.getCode(lcmbCode);

        List<OaSysFlowNode> node = sysFlowNodeService.getFirstNode(code.getId());

        List<OaJobEntity> list = spcySqsxJobService.list(new LambdaQueryWrapper<OaJobEntity>()
                .eq(OaJobEntity::getFpid, oaid)
                .eq(OaJobEntity::getFhjmc, node.get(0).getFjdmc())
                .eq(OaJobEntity::getFlcmc, code.getFlcmc())
        );
        if (list.size() > 0) {
            List<String> ids = list.stream().map(OaJobEntity::getId).collect(Collectors.toList());
            spcySqsxJobService.removeBatchByIds(ids);
        }
        return this.createJob(lcmbCode, oaid, "", node.get(0), null, null, currentUser);
    }


    /**
     * 提交环节待办记录 并创建下一环节待办
     *
     * @param oaId           业务id
     * @param jobId          流程id
     * @param opinion        意见
     * @param nextNodeId     下一节点id
     * @param nextNodeDbrIds 下一节点待办人
     * @return
     */
    public Result passJob(String oaId, String jobId, String opinion, String nextNodeId, String nextNodeDbrIds) {
        //处理业务表的逻辑
        String lcmbCode = "";

        lcmbCode = OaFlowConstant.NK_YSSBLC;
        Result httpResult = passJob(lcmbCode, oaId, jobId, opinion, nextNodeId, nextNodeDbrIds, true);
        return httpResult;
    }

    /**
     * @param nowNodeid 当前节点id
     * @param jobId     当前流程id
     * @return 获取环节待办人
     */
    public Map getNodeDbrids(String nowNodeid, String jobId) {
        CurrentUserVo currentUser = ThreadContextHelper.getCurrentUser();
        OaSysFlowNode oaSysFlowNode = sysFlowNodeService.getById(nowNodeid);
        Integer fsfcjdpzhq = oaSysFlowNode.getFsfcjdpzhq(); //是否从节点配置获取待办人
        String fblbmlx = oaSysFlowNode.getFblbmlx(); //办理部门类型
        String fblbmid = oaSysFlowNode.getFblbmid(); //办理部门id

        String fblgwid = oaSysFlowNode.getFblgwid(); //办理岗位id

        String fblrid = oaSysFlowNode.getFblrid(); //办理人id
        Integer fsfzdblr = oaSysFlowNode.getFsfzdblr(); //是否指定办理人
        Integer fsfzddlr = oaSysFlowNode.getFsfzddlr(); //是否指定登陆人为办理人
        Map map = new HashMap();
        //是否从节点配置获取待办人：0是 / 1否  为0则读取当前节点配置的环节办理人
        if (fsfcjdpzhq.equals(OaFlowNodeConstant.SFZD_YES)) {
            //如果指定办理人 直接返回指定人
            if (fsfzdblr.equals(OaFlowNodeConstant.SFZD_YES)) {
                if (StringUtils.isBlank(fblrid)) {
                    throw new BusinessException("查询不到指定办理人");
                }
                String dbrName = oaFlowNodeDbrService.getDbrNameById(fblrid);
                map.put("dbr", dbrName);
                map.put("dbrId", fblrid);
                return map;
            }
            //如果指定当前登陆人 则返回当前登录用户
            if (fsfzddlr.equals(OaFlowNodeConstant.SFZD_YES)) {
                String dbrid = currentUser.getId();
                String dbrname = currentUser.getName();
                map.put("dbr", dbrname);
                map.put("dbrId", dbrid);
                return map;
            }
            Map dbrByBmGw = getDbrByBmGw(fblbmid, fblgwid);
            //如果办理部门类型为 指定 则待办人 进入 根据部门和岗位判断
            if (fblbmlx.equals(OaFlowNodeConstant.BLJD_BLBM_ZD)) {
                return dbrByBmGw;
                //在判断 办理部门类型为 不指定 则 待办人 根据 办理岗位id 来 判断
            } else if (fblbmlx.equals(OaFlowNodeConstant.BLJD_BLBM_BZD)) {
                //否则根据办理部门id返回待办人
                return dbrByBmGw;
            } else if (fblbmlx.equals(OaFlowNodeConstant.BLJD_BLBM_DQBM) && StringUtils.isNotBlank(jobId)) {
                //在这里写 如果 为当前部门 传入 业务id 根据 jobid 拿到所有信息
                //通过jobId 拿到nowNodeId
                OaJobEntity oaJobEntity = spcySqsxJobService.getById(jobId);
                String fnodeid = oaJobEntity.getFnodeid(); //获取当前节点id
                String fpid = oaJobEntity.getFpid();
                OaSysFlowNode flowNodeServiceById = sysFlowNodeService.getById(fnodeid);
                String flcmbid = flowNodeServiceById.getFlcmbid(); //通过流程模板id 可以获取流程节点的第一个环节
                List<OaSysFlowNode> firstNode = sysFlowNodeService.getFirstNode(flcmbid);
                String firstNodeId = firstNode.get(0).getId();//获取第一个流程节点的id
                //通过流程节点id 和jobid 对比 获取第一环节办理人姓名和id
                List<OaJobEntity> list = spcySqsxJobService.list(new LambdaQueryWrapper<OaJobEntity>().eq(OaJobEntity::getFpid, fpid)
                        .eq(OaJobEntity::getFnodeid, firstNodeId));
                String fdbrid = list.get(0).getFdbrid();
                //String orgId = ycSysUserService.getById(fdbrid).getOrgId();
                String orgId = ycSysUserService.getUserZbmByUserId(fdbrid);
                Map ByBmGw = getDbrByBmGw(orgId, fblgwid);
                return ByBmGw;
            } else if (fblbmlx.equals(OaFlowNodeConstant.BLJD_BLBM_DQBM)) {
                return dbrByBmGw;
            }
        } else {
            map.put("dbr", "");
            map.put("dbrId", "");
            return map;
        }
        return map;
    }

    //根据办理部门id 和 办理岗位id 判断返回待办人
    public Map getDbrByBmGw(String fblbmid, String fblgwid) {
        Map map = new HashMap();
        String dbr = "";
        String dbrid = "";
        //null null  办理部门id和办理岗位id都为空 直接返回为空
        if (StringUtils.isBlank(fblbmid) && StringUtils.isBlank(fblgwid)) {
            map.put("dbr", dbr);
            map.put("dbrId", dbrid);
            return map;
        }
        //null not  办理部门id为空 办理岗位id不为空  返回当前办理岗位的所有人
        if (StringUtils.isBlank(fblbmid) && StringUtils.isNotBlank(fblgwid)) {
            //
            return oaFlowNodeDbrService.getDbrByGwid(fblgwid);
        }
        //not null 办理部门id不为空 办理岗位id为空  返回当前部门id的所有人
        if (StringUtils.isNotBlank(fblbmid) && StringUtils.isBlank(fblgwid)) {
            return oaFlowNodeDbrService.getDbrByBmid(fblbmid);
        }
        // not not 办理部门id 和办理岗位id 都不为空 则返回当前部门下 当前办理岗位的用户
        if (StringUtils.isNotBlank(fblbmid) && StringUtils.isNotBlank(fblgwid)) {
            //先判断办理岗位id 是不是分管领导
            List<OaSysJob> oaSysJobs = sysJobService.list(new LambdaQueryWrapper<OaSysJob>().eq(OaSysJob::getId, fblgwid));
            String jobName = oaSysJobs.get(0).getJobName();
            if (jobName.equals(OaFlowNodeConstant.ROLE_NAME_FGLD)) {
                return oaFlowNodeDbrService.getKsFgldByDeptName(fblbmid);
            } else {
                return oaFlowNodeDbrService.getdbrByDeptName(fblbmid, fblgwid);
            }


        }
        map.put("dbr", dbr);
        map.put("dbrId", dbrid);
        return map;
    }


    /**
     * 创建流程
     *
     * @param lcmbCode    流程编码code
     * @param pid         业务id
     * @param dbrId       待办人id
     * @param nowNode     当前节点对象
     * @param nowJob      当前流程对象
     * @param nextNodeId  下一环节id
     * @param currentUser 当前登陆人
     * @return
     */
    public Result createJob(String lcmbCode, String pid, String dbrId, OaSysFlowNode nowNode, OaJobEntity nowJob, String nextNodeId, CurrentUserVo currentUser) {
        String jobId = "";
        //如果  nextNodeId 不为空 则nowNode 直接等于传过来的nextNodeId 否则在判断 nowJob 为不为空
        if (StringUtils.isNotBlank(nextNodeId)) {
            nowNode = sysFlowNodeService.getById(nextNodeId);
            if (nowJob != null) {
                jobId = nowJob.getId();
            }
        } else
            //如果nowJob 不为空
            if (nowJob != null) {
                String fnodeid1 = nowJob.getFnodeid();
                jobId = nowJob.getId();
                List<OaSysFlowNode> nextNode = sysFlowNodeService.getNextNode(fnodeid1);
                if (nextNode == null) {
                    throw new BusinessException("");
                }
                if (nextNode.size() > 1) {
                    if (StringUtils.isBlank(nextNodeId)) {
                        throw new BusinessException("请选择提交环节");
                    } else {
                        nowNode = sysFlowNodeService.getById(nextNodeId);
                    }
                } else {
                    nowNode = nextNode.get(0);
                }
            } else {
                if (nowNode == null) {
                    throw new BusinessException("");
                }

            }
        String fnodeid = "";
        fnodeid = nowNode.getId();

        String fblfs = nowNode.getFblfs();
        String fjdmc = nowNode.getFjdmc();
        Integer fsfcjdpzhq = nowNode.getFsfcjdpzhq();

        String lcmc = sysFlowNodeService.getCode(lcmbCode).getFlcmc();

        OaJobEntity job = new OaJobEntity();
        job.setId(GetUuIdUtils.generateUuid());
        job.setFpid(pid);
        job.setFblfs(fblfs);
        job.setFhjmc(fjdmc);
        job.setFywlx(OaFlowConstant.OA);
        job.setFblzt(OaCommonFlowConstant.BLZT_DB);
        if (nowJob == null) {
            job.setFsyhjid("");
        } else {
            job.setFsyhjid(nowJob.getId());
        }

        job.setFlcmc(lcmc);
        job.setFnodeid(fnodeid);
        if (currentUser != null) {
            job.setFfsrid(currentUser.getId());
            job.setFfsrmc(currentUser.getName());
        }
        job.setFfssj(new Date());
        //待办人和原待办人
        if (StringUtils.isNotBlank(dbrId)) {
            job.setFdbrid(dbrId);
            job.setFdbr(oaFlowNodeDbrService.getDbrNameById(dbrId));
            job.setFydbr(oaFlowNodeDbrService.getDbrNameById(dbrId));
            job.setFydbrid(dbrId);
            spcySqsxJobService.save(job);
            return Result.ok(job);
        }


        if (fsfcjdpzhq.equals(OaFlowNodeConstant.SFZD_YES)) {
            Map nodeDbrids = getNodeDbrids(fnodeid, jobId);
            dbrId = nodeDbrids.get("dbrId").toString();
            String dbr = nodeDbrids.get("dbr").toString();
            job.setFdbr(dbr);
            job.setFdbrid(dbrId);
            job.setFydbr(dbr);
            job.setFydbrid(dbrId);
            spcySqsxJobService.save(job);
            return Result.ok(job);
        } else {
            String dbrName = oaFlowNodeDbrService.getDbrNameById(dbrId);
            job.setFdbr(dbrName);
            job.setFdbrid(dbrId);
            job.setFydbr(dbrName);
            job.setFydbrid(dbrId);
            spcySqsxJobService.save(job);
            return Result.ok(job);
        }
    }


    /**
     * 提交任务
     *
     * @param lcmbCode         流程模板编码
     * @param pid              主业务id
     * @param jobId            流程id
     * @param opinion          意见
     * @param nextNodeId       下一节点id
     * @param nextNodeDbrIds   下一节点待办人
     * @param isOverCurrentJob 是否办结 创建
     * @return
     */
    public Result passJob(String lcmbCode, String pid, String jobId, String opinion, String nextNodeId, String nextNodeDbrIds, boolean isOverCurrentJob) {

        // 获得当前待办任务，并做校验
        OaJobEntity job = spcySqsxJobService.getById(jobId);
        if (job == null) {
            return Result.error("查不到id为【" + jobId + "】的待办任务");
        }

        //获取办理人，并做办理人的校验，如果当前登录人不是待办人之一，拒绝办理
        CurrentUserVo currentUser = ThreadContextHelper.getCurrentUser();
        if (currentUser == null) {
            return Result.error("请先登录");
        }
        if (isOverCurrentJob) {
            //办理掉当前环节
            Result result = doJob(jobId, opinion);
            //在这里判断 是否是最后一个节点 如果是返回一个新的空对象
            boolean endNode = sysFlowNodeService.endNode(job.getFnodeid());
            if (endNode) {
                OaJobEntity job1 = new OaJobEntity();
                return Result.ok(job1);
            }

            job = (OaJobEntity) result.getResult();
            //生成下一环节的待办
            if (result.isSuccess()) {
//                job = (SpcySqsxJob) result.getResult();

                if (job.getFblzt().equals(OaCommonFlowConstant.BLZT_YB)) {
                    //创建下一环节任务
                    Result result1 = createJob(lcmbCode, pid, nextNodeDbrIds, null, job, nextNodeId, currentUser);
                    if (!result1.isSuccess()) {
                        return Result.error(result1.getMessage());
                    } else {
                        // 3-16 返回新增的流程任务
                        return Result.ok(result1.getResult());
                    }
                }
                // 3-16 返回当前流程任务
                return Result.ok(job);
            } else {
                return Result.error(result.getMessage());
            }
        } else {

            //创建下一环节任务
            Result result1 = createJob(lcmbCode, pid, nextNodeDbrIds, null, job, nextNodeId, currentUser);
            if (!result1.isSuccess()) {
                return Result.error(result1.getMessage());
            } else {
                // 3-16 返回新增的流程任务
                return Result.ok(result1.getResult());
            }
        }
    }

    /**
     * 办理环节
     *
     * @param job         当前流程任务
     * @param currentUser 当前用户
     * @param opinion     意见
     * @param returnNode  退回环节
     */
    private Result doJob(OaJobEntity job, CurrentUserVo currentUser, String opinion, String returnNode) {
        String blrId = "";
        String blr = "";
        String blbm = "";
        if (currentUser != null) {
            blrId = currentUser.getId();
            blr = currentUser.getName();
            blbm = currentUser.getOrgName();
        }
        if (job == null) {
            return Result.error("当前流程任务不存在，请重试");
        }
//        if(CommonFlowConstant.BLZT_YB.equals(job.getFblzt())){
//            return Result.error("当前任务已提交");
//        }
        if (StringUtils.isBlank(job.getFdbrid())) {
            return Result.error("当前任务未指定办理人");
        }
//        if(!job.getFdbrid().contains(blrId)){
//            return Result.error("当前登录用户无此任务的办理权限");
//        }
        // 办理方式 竞争办理 、多人线性办理 、多人并行办理
        String blfs = job.getFblfs();
        if (StringUtils.isBlank(blfs) || blfs.equals(OaCommonFlowConstant.BLFS_DRJJ)) {
            job.setFblr(blr);
            job.setFblsj(new Date());
            job.setFblyj(opinion);
            job.setFblzt(OaCommonFlowConstant.BLZT_YB);
            if (StringUtils.isBlank(returnNode)) {
                job.setFbllx(OaCommonFlowConstant.BLLX_BL);
            } else {
                job.setFbllx(returnNode);
            }
            job.setFblbm(blbm);

            // 审评查验流程 计算 办理天数、是否超时
            /*if (StringUtils.isNotBlank(job.getFlcmc()) && job.getFlcmc().contains(YpscFlowConstant.LCMC_LIKE_SPCYLC)) {
                job.setFsyts(flowJobBlsxService.jsTwoDateBetweenDays(job.getFksyts(),job.getFpid(),job.getFfssj(), job.getFblsj(), job.getFztkssj(),job.getFztjssj())); // 使用天数
                job.setFsfcs(flowJobBlsxService.isDateBetweenSfcs(job.getFsyts(), job.getFcnts())); // 办理是否超时
            }*/

            spcySqsxJobService.updateById(job);
            return Result.ok(job);
        } else if (blfs.equals(OaCommonFlowConstant.BLFS_DRXX) || blfs.equals(OaCommonFlowConstant.BLFS_DRBX)) {
            //先根据多个人线性和多人并行的逻辑获得下一办理人
            String nextBlrId = "";
            String nextBlr = "";
            if (blfs.equals(OaCommonFlowConstant.BLFS_DRXX)) {
                String ydbrIds[] = job.getFydbrid().split(",");
                String ydbrs[] = job.getFydbr().split(",");
                for (int i = 0; i < ydbrIds.length; i++) {
                    String dbrId = ydbrIds[i];
                    //不考虑办理人id重复出现（一个人办多次）的情况
                    if (dbrId.equals(blrId)) {
                        if (i + 1 < ydbrIds.length) {
                            nextBlrId = ydbrIds[i + 1];
                            nextBlr = ydbrs[i + 1];
                            break;
                        }
                    }
                }
            } else {
                String dbrIds[] = job.getFdbrid().split(",");
                String dbrs[] = job.getFdbr().split(",");
                for (int i = 0; i < dbrIds.length; i++) {
                    String dbrId = dbrIds[i];
                    String dbr = dbrs[i];
                    //不考虑办理人id重复出现（一个人办多次）的情况
                    if (!dbrId.equals(blrId)) {
                        nextBlrId = nextBlrId + (StringUtils.isBlank(nextBlrId) ? "" : ",") + dbrId;
                        nextBlr = nextBlr + (StringUtils.isBlank(nextBlr) ? "" : ",") + dbr;
                    }
                }
            }

            //如果存在下一办理人 就继续待办，多人办理意见用@@分隔，办理时间、办理人、意见 用|分隔
            job.setFblr(blr);
            job.setFblsj(new Date());
            String blyj = (job.getFblyj() == null ? "" : job.getFblyj()) + (StringUtils.isBlank(job.getFblyj()) ? "" : "@@") + DateConversionUtils.DateToString(new Date()) + "|" + blr + "|" + opinion;
            job.setFblyj(blyj);
            if (StringUtils.isBlank(nextBlrId)) {
                job.setFblzt(OaCommonFlowConstant.BLZT_YB);
                if (StringUtils.isBlank(returnNode)) {
                    job.setFbllx(OaCommonFlowConstant.BLLX_BL);
                } else {
                    job.setFbllx(returnNode);
                }
                job.setFblbm(blbm);
            } else {
                job.setFblzt(OaCommonFlowConstant.BLZT_DB);
                job.setFdbrid(nextBlrId);
                job.setFdbr(nextBlr);
            }
            spcySqsxJobService.updateById(job);
            return Result.ok(job);
        }
        return Result.error("待办任务未指定办理方式");
    }

    /**
     * @param job
     * @Description 办结当前环节
     */
    public Result doJob(String job, String opinion) {
        OaJobEntity byId = spcySqsxJobService.getById(job);
        CurrentUserVo currentUser = ThreadContextHelper.getCurrentUser();
        String blrId = "";
        String blr = "";
        if (currentUser != null) {
            blrId = currentUser.getId();
            blr = currentUser.getName();
        }
        if (job == null) {
            return Result.error("当前流程任务不存在，请重试");
        }
        if (OaCommonFlowConstant.BLZT_YB.equals(byId.getFblzt())) {
            return Result.error("当前任务已提交");
        }
//        if(StringUtils.isBlank(job.getFdbrid())){
//            return Result.error("当前任务未指定办理人");
//        }
        if (!byId.getFdbrid().contains(blrId)) {
            return Result.error("当前登录用户无此任务的办理权限");
        }
        // 办理方式  、多人竞争办理
        String blfs = byId.getFblfs();
        if (StringUtils.isBlank(blfs) || blfs.equals(OaCommonFlowConstant.BLFS_DRJJ)) {
            byId.setFblr(blr);
            byId.setFblsj(new Date());
            byId.setFblyj(opinion);
            byId.setFblzt(OaCommonFlowConstant.BLZT_YB);
            spcySqsxJobService.updateById(byId);
            return Result.ok(byId);
        } else if (blfs.equals(OaCommonFlowConstant.BLFS_DRXX) || blfs.equals(OaCommonFlowConstant.BLFS_DRBX)) {
            //先根据多个人线性和多人并行的逻辑获得下一办理人
            String nextBlrId = "";
            String nextBlr = "";
            if (blfs.equals(OaCommonFlowConstant.BLFS_DRXX)) {
                String ydbrIds[] = byId.getFydbrid().split(",");
                String ydbrs[] = byId.getFydbr().split(",");
                for (int i = 0; i < ydbrIds.length; i++) {
                    String dbrId = ydbrIds[i];
                    //不考虑办理人id重复出现（一个人办多次）的情况
                    if (dbrId.equals(blrId)) {
                        if (i + 1 < ydbrIds.length) {
                            nextBlrId = ydbrIds[i + 1];
                            nextBlr = ydbrs[i + 1];
                            break;
                        }
                    }
                }
            } else {
                String dbrIds[] = byId.getFdbrid().split(",");
                String dbrs[] = byId.getFdbr().split(",");
                for (int i = 0; i < dbrIds.length; i++) {
                    String dbrId = dbrIds[i];
                    String dbr = dbrs[i];
                    //不考虑办理人id重复出现（一个人办多次）的情况
                    if (!dbrId.equals(blrId)) {
                        nextBlrId = nextBlrId + (StringUtils.isBlank(nextBlrId) ? "" : ",") + dbrId;
                        nextBlr = nextBlr + (StringUtils.isBlank(nextBlr) ? "" : ",") + dbr;
                    }
                }
            }

            //如果存在下一办理人 就继续待办，多人办理意见用@@分隔，办理时间、办理人、意见 用|分隔
            byId.setFblr(blr);
            byId.setFblsj(new Date());
            String blyj = (byId.getFblyj() == null ? "" : byId.getFblyj()) + (StringUtils.isBlank(byId.getFblyj()) ? "" : "@@") + DateConversionUtils.DateToString(new Date()) + "|" + blr + "|" + opinion;
            byId.setFblyj(blyj);
            if (StringUtils.isBlank(nextBlrId)) {
                byId.setFblzt(OaCommonFlowConstant.BLZT_YB);
            } else {
                byId.setFblzt(OaCommonFlowConstant.BLZT_DB);
                byId.setFdbrid(nextBlrId);
                byId.setFdbr(nextBlr);
            }
            spcySqsxJobService.updateById(byId);
            return Result.ok(byId);
        }
        return Result.error("待办任务未指定办理方式");
    }




    /**
     * 查询流程当前环节-上一环节
     * * @param jobid 流程任务id
     * * @param isZdhj 是否指定环节
     * * @return
     */
    public List<Map<String, String>> getCurrentJobPrevious(String jobid, boolean isZdhj) {
        if (StringUtils.isBlank(jobid)) {
            throw new BusinessException("流程任务参数为空！");
        }

        OaJobEntity currentJob = spcySqsxJobService.getById(jobid);
        if (currentJob == null) {
            throw new BusinessException("当前流程任务不存在！");
        }


        String fpid = currentJob.getFpid(); // 关联业务id
        String flcmc = currentJob.getFlcmc(); // 所属流程名称
        String fnodeid = currentJob.getFnodeid(); //当前节点名称


        List<Map<String, String>> ybNodeList = new ArrayList<>(); // 退回环节数组
        String previousNode = this.getPreviousNodeBynodeId(fnodeid); // 上一环节

        // 指定环节
        if (isZdhj) {
            List<OaJobEntity> preJobList = spcySqsxJobService.list(new LambdaQueryWrapper<OaJobEntity>()
                    .eq(OaJobEntity::getFpid, fpid)
                    .eq(OaJobEntity::getFblzt, OaCommonFlowConstant.BLZT_YB)
                    .eq(OaJobEntity::getFlcmc, flcmc)
                    .orderByAsc(OaJobEntity::getFfssj));
            if (CollectionUtils.isNotEmpty(preJobList)) {
                for (OaJobEntity job : preJobList) {

                    // 判断是否存在一样的环节名称，存在跳出当次循环
                    boolean isExistNode = false;
                    if (CollectionUtils.isNotEmpty(ybNodeList)) {
                        for (Map<String, String> disMap : ybNodeList) {
                            if (disMap.get("fhjmc").equals(job.getFhjmc())) {
                                isExistNode = true;
                                break;
                            }
                        }
                    }
                    if (isExistNode) {
                        continue;
                    }
                    Map<String, String> map = new HashMap<>();
                    map.put("id", job.getId());
                    map.put("fhjmc", job.getFhjmc());
                    ybNodeList.add(map);
                }
            }
        } else {
            // 查询上一环节是否存在
            List<OaJobEntity> preJobList = spcySqsxJobService.list(new LambdaQueryWrapper<OaJobEntity>()
                    .eq(OaJobEntity::getFpid, fpid)
                    .eq(OaJobEntity::getFhjmc, previousNode)
                    .eq(OaJobEntity::getFblzt, OaCommonFlowConstant.BLZT_YB)
                    .eq(OaJobEntity::getFlcmc, flcmc)
                    .orderByDesc(OaJobEntity::getFfssj));

            if (CollectionUtils.isNotEmpty(preJobList)) {
                Map<String, String> map = new HashMap<>();
                map.put("id", preJobList.get(0).getId());
                map.put("fhjmc", preJobList.get(0).getFhjmc());
                ybNodeList.add(map);
            }
        }
        return ybNodeList;
    }

    /**
     * 退回流程 - 指定环节
     */
    public void returnZdJob(OaReturnVo oaReturnVo) {
        CurrentUserVo currentUser = ThreadContextHelper.getCurrentUser();
        if (currentUser == null) {
            throw new BusinessException("登录已失效，请重新登录！");
        }

        if (StringUtils.isBlank(oaReturnVo.getJobid())) {
            throw new BusinessException("流程任务参数为空！");
        }

        if (StringUtils.isBlank(oaReturnVo.getOpinion())) {
            throw new BusinessException("请填写退回意见！");
        }

        if (StringUtils.isBlank(oaReturnVo.getShjid())) {
            throw new BusinessException("请选择退回环节！");
        }

        // 当前环节
        OaJobEntity currentJob = spcySqsxJobService.getById(oaReturnVo.getJobid());
        if (currentJob == null) {
            throw new BusinessException("当前流程任务不存在！");
        }

        String sqsxid = currentJob.getFpid();
        String oldfhjmc = currentJob.getFhjmc();


        // 上一环节
        OaJobEntity previousJob = spcySqsxJobService.getById(oaReturnVo.getShjid());
        if (currentJob == null) {
            throw new BusinessException("当前流程任务不存在！");
        }
        String previousNode = previousJob.getFhjmc();

        String bllx = "[" + oldfhjmc + "]" + OaCommonFlowConstant.BLLX_TH + "[" + previousNode + "]";
        Result result = this.doJob(currentJob, currentUser, oaReturnVo.getOpinion(), bllx);
        if (!result.isSuccess()) {
            throw new BusinessException(result.getMessage());
        }

        /**
         * 创建退回环节流程任务
         */
        OaJobEntity newPreviousJob = new OaJobEntity();
        BeanUtil.copyProperties(previousJob, newPreviousJob);
        newPreviousJob.setId(GetUuIdUtils.NotReplaceUuId());

        if (StringUtils.isBlank(newPreviousJob.getFpid())) {
            newPreviousJob.setFpid(sqsxid);
        }


        newPreviousJob.setFblzt(OaCommonFlowConstant.BLZT_TH);
        newPreviousJob.setFblyj("");
        newPreviousJob.setFblr("");
        newPreviousJob.setFblsj(null);
        newPreviousJob.setFblbm("");
        newPreviousJob.setFthyj(oaReturnVo.getOpinion());
        newPreviousJob.setFlcmc(OaFlowConstant.OA_JBZB_NAME);
        newPreviousJob.setFbllx("");
        newPreviousJob.setFfssj(new Date());
        newPreviousJob.setFfsrid(currentUser.getId());
        newPreviousJob.setFfsrmc(currentUser.getName());
        newPreviousJob.setFsfkch("");
        spcySqsxJobService.save(newPreviousJob);
        //处理主表数据
        NkBmysxmsbsplc nkBmysxmsbsplc = nbmysxmsbsplcService.getById(sqsxid);
        if (previousNode.equals(OaFlowConstant.YSSBLC_CWSH_YS)) {
            nkBmysxmsbsplc.setFdycshhyjy("");
            nkBmysxmsbsplc.setFdycshhyjysj("");
            nkBmysxmsbsplc.setFdycshhyjyr("");
            nkBmysxmsbsplc.setFdycxhhyjy("");
            nkBmysxmsbsplc.setFdycxhhyjysj("");
            nkBmysxmsbsplc.setFdycxhhyjyr("");
            nkBmysxmsbsplc.setFdecshhyjy("");
            nkBmysxmsbsplc.setFdecshhyjysj("");
            nkBmysxmsbsplc.setFdecshhyjyr("");
            nkBmysxmsbsplc.setFdecxhhyjy("");
            nkBmysxmsbsplc.setFdecxhhyjysj("");
            nkBmysxmsbsplc.setFdecxhhyjyr("");


            //一上
            nkBmysxmsbsplc.setFyscwshrid("");
            nkBmysxmsbsplc.setFyscwshr("");
            nkBmysxmsbsplc.setFyscwshyj("");
            nkBmysxmsbsplc.setFyscwshyjsj("");
            nkBmysxmsbsplc.setFysbgsldshrid("");
            nkBmysxmsbsplc.setFysbgsldshr("");
            nkBmysxmsbsplc.setFysbgsldshyj("");
            nkBmysxmsbsplc.setFysbgsldshyjsj("");
            nkBmysxmsbsplc.setFyszxldshrid("");
            nkBmysxmsbsplc.setFyszxldshr("");
            nkBmysxmsbsplc.setFyszxldshyj("");
            nkBmysxmsbsplc.setFyszxldshyjsj("");

            //二上
            nkBmysxmsbsplc.setFescwshrid("");
            nkBmysxmsbsplc.setFescwshr("");
            nkBmysxmsbsplc.setFescwshyj("");
            nkBmysxmsbsplc.setFescwshyjsj("");
            nkBmysxmsbsplc.setFesbgsldshrid("");
            nkBmysxmsbsplc.setFesbgsldshr("");
            nkBmysxmsbsplc.setFesbgsldshyj("");
            nkBmysxmsbsplc.setFesbgsldshyjsj("");
            nkBmysxmsbsplc.setFeszxldshrid("");
            nkBmysxmsbsplc.setFeszxldshr("");
            nkBmysxmsbsplc.setFeszxldshyj("");
            nkBmysxmsbsplc.setFeszxldshyjsj("");

            nkBmysxmsbsplc.setFlczt(OaCommonFlowConstant.FLOW_LCZB);


        } else if (previousNode.equals(OaFlowConstant.YSSBLC_SQ_YS)) {

            nkBmysxmsbsplc.setFdycshhyjy("");
            nkBmysxmsbsplc.setFdycshhyjysj("");
            nkBmysxmsbsplc.setFdycshhyjyr("");
            nkBmysxmsbsplc.setFdycxhhyjy("");
            nkBmysxmsbsplc.setFdycxhhyjysj("");
            nkBmysxmsbsplc.setFdycxhhyjyr("");
            nkBmysxmsbsplc.setFdecshhyjy("");
            nkBmysxmsbsplc.setFdecshhyjysj("");
            nkBmysxmsbsplc.setFdecshhyjyr("");
            nkBmysxmsbsplc.setFdecxhhyjy("");
            nkBmysxmsbsplc.setFdecxhhyjysj("");
            nkBmysxmsbsplc.setFdecxhhyjyr("");

            //一上
            nkBmysxmsbsplc.setFysbgsldshrid("");
            nkBmysxmsbsplc.setFysbgsldshr("");
            nkBmysxmsbsplc.setFysbgsldshyj("");
            nkBmysxmsbsplc.setFysbgsldshyjsj("");
            nkBmysxmsbsplc.setFyszxldshrid("");
            nkBmysxmsbsplc.setFyszxldshr("");
            nkBmysxmsbsplc.setFyszxldshyj("");
            nkBmysxmsbsplc.setFyszxldshyjsj("");

            //二上
            nkBmysxmsbsplc.setFescwshrid("");
            nkBmysxmsbsplc.setFescwshr("");
            nkBmysxmsbsplc.setFescwshyj("");
            nkBmysxmsbsplc.setFescwshyjsj("");
            nkBmysxmsbsplc.setFesbgsldshrid("");
            nkBmysxmsbsplc.setFesbgsldshr("");
            nkBmysxmsbsplc.setFesbgsldshyj("");
            nkBmysxmsbsplc.setFesbgsldshyjsj("");
            nkBmysxmsbsplc.setFeszxldshrid("");
            nkBmysxmsbsplc.setFeszxldshr("");
            nkBmysxmsbsplc.setFeszxldshyj("");
            nkBmysxmsbsplc.setFeszxldshyjsj("");


            nkBmysxmsbsplc.setFlczt(OaCommonFlowConstant.FLOW_LCZB);


        } else if (previousNode.equals(OaFlowConstant.YSSBLC_ZXZRSH_YS)) {

            nkBmysxmsbsplc.setFdycshhyjy("");
            nkBmysxmsbsplc.setFdycshhyjysj("");
            nkBmysxmsbsplc.setFdycshhyjyr("");
            nkBmysxmsbsplc.setFdycxhhyjy("");
            nkBmysxmsbsplc.setFdycxhhyjysj("");
            nkBmysxmsbsplc.setFdycxhhyjyr("");
            nkBmysxmsbsplc.setFdecshhyjy("");
            nkBmysxmsbsplc.setFdecshhyjysj("");
            nkBmysxmsbsplc.setFdecshhyjyr("");
            nkBmysxmsbsplc.setFdecxhhyjy("");
            nkBmysxmsbsplc.setFdecxhhyjysj("");
            nkBmysxmsbsplc.setFdecxhhyjyr("");

            //一上

            nkBmysxmsbsplc.setFyszxldshrid("");
            nkBmysxmsbsplc.setFyszxldshr("");
            nkBmysxmsbsplc.setFyszxldshyj("");
            nkBmysxmsbsplc.setFyszxldshyjsj("");

            //二上
            nkBmysxmsbsplc.setFescwshrid("");
            nkBmysxmsbsplc.setFescwshr("");
            nkBmysxmsbsplc.setFescwshyj("");
            nkBmysxmsbsplc.setFescwshyjsj("");
            nkBmysxmsbsplc.setFesbgsldshrid("");
            nkBmysxmsbsplc.setFesbgsldshr("");
            nkBmysxmsbsplc.setFesbgsldshyj("");
            nkBmysxmsbsplc.setFesbgsldshyjsj("");
            nkBmysxmsbsplc.setFeszxldshrid("");
            nkBmysxmsbsplc.setFeszxldshr("");
            nkBmysxmsbsplc.setFeszxldshyj("");
            nkBmysxmsbsplc.setFeszxldshyjsj("");


            nkBmysxmsbsplc.setFlczt(OaCommonFlowConstant.FLOW_LCZB);


        } else if (previousNode.equals(OaFlowConstant.YSSBLC_CWSH_ES)) {

            nkBmysxmsbsplc.setFdycshhyjy("");
            nkBmysxmsbsplc.setFdycshhyjysj("");
            nkBmysxmsbsplc.setFdycshhyjyr("");
            nkBmysxmsbsplc.setFdycxhhyjy("");
            nkBmysxmsbsplc.setFdycxhhyjysj("");
            nkBmysxmsbsplc.setFdycxhhyjyr("");
            nkBmysxmsbsplc.setFdecshhyjy("");
            nkBmysxmsbsplc.setFdecshhyjysj("");
            nkBmysxmsbsplc.setFdecshhyjyr("");
            nkBmysxmsbsplc.setFdecxhhyjy("");
            nkBmysxmsbsplc.setFdecxhhyjysj("");
            nkBmysxmsbsplc.setFdecxhhyjyr("");


            //二上
            nkBmysxmsbsplc.setFescwshrid("");
            nkBmysxmsbsplc.setFescwshr("");
            nkBmysxmsbsplc.setFescwshyj("");
            nkBmysxmsbsplc.setFescwshyjsj("");
            nkBmysxmsbsplc.setFesbgsldshrid("");
            nkBmysxmsbsplc.setFesbgsldshr("");
            nkBmysxmsbsplc.setFesbgsldshyj("");
            nkBmysxmsbsplc.setFesbgsldshyjsj("");
            nkBmysxmsbsplc.setFeszxldshrid("");
            nkBmysxmsbsplc.setFeszxldshr("");
            nkBmysxmsbsplc.setFeszxldshyj("");
            nkBmysxmsbsplc.setFeszxldshyjsj("");


            nkBmysxmsbsplc.setFlczt(OaCommonFlowConstant.FLOW_LCZB);
        } else if (previousNode.equals(OaFlowConstant.YSSBLC_SQ_ES)) {

            nkBmysxmsbsplc.setFdycshhyjy("");
            nkBmysxmsbsplc.setFdycshhyjysj("");
            nkBmysxmsbsplc.setFdycshhyjyr("");
            nkBmysxmsbsplc.setFdycxhhyjy("");
            nkBmysxmsbsplc.setFdycxhhyjysj("");
            nkBmysxmsbsplc.setFdycxhhyjyr("");
            nkBmysxmsbsplc.setFdecshhyjy("");
            nkBmysxmsbsplc.setFdecshhyjysj("");
            nkBmysxmsbsplc.setFdecshhyjyr("");
            nkBmysxmsbsplc.setFdecxhhyjy("");
            nkBmysxmsbsplc.setFdecxhhyjysj("");
            nkBmysxmsbsplc.setFdecxhhyjyr("");


            nkBmysxmsbsplc.setFesbgsldshrid("");
            nkBmysxmsbsplc.setFesbgsldshr("");
            nkBmysxmsbsplc.setFesbgsldshyj("");
            nkBmysxmsbsplc.setFesbgsldshyjsj("");
            nkBmysxmsbsplc.setFeszxldshrid("");
            nkBmysxmsbsplc.setFeszxldshr("");
            nkBmysxmsbsplc.setFeszxldshyj("");
            nkBmysxmsbsplc.setFeszxldshyjsj("");

            nkBmysxmsbsplc.setFlczt(OaCommonFlowConstant.FLOW_LCZB);

        }
        nbmysxmsbsplcService.updateById(nkBmysxmsbsplc);
    }


    /**
     * 获取上一环节-通过当前流程节点id
     *
     * @param nodeId 当前节点id
     * @return
     */
    private String getPreviousNodeBynodeId(String nodeId) {
        String preNode = "";
        List<OaSysFlowNode> previousNode = sysFlowNodeService.getPreviousNode(nodeId);
        preNode = previousNode.get(0).getFjdmc();
        return preNode;
    }


    /**
     *
     */

    public List firstJs(String jhid, String jclx) {
        //多个部门的合计 map ，最后再用list全部放进去
        if (jclx.equals(OaCommonFlowConstant.XMNR_JC)) {
            //办公室
            Map bgshj = new HashMap<>();
            //人教科
            Map rjkhj = new HashMap<>();
            //质量管理与科研科
            Map zlglykykhj = new HashMap<>();

            //药品注册审评查验科
            //药品
            Map ypzcspcykclfhjyp = new HashMap<>();
            //临床
            Map ypzcspcykclfhjlc = new HashMap<>();

            //药品生产查验科
            Map ypsccykhj = new HashMap<>();
            //药品流通查验科
            Map ypltcykhj = new HashMap<>();
            //医疗器械审评查验1科
            Map ylqxspcykykhj = new HashMap<>();
            //医疗器械审评查验2科
            Map ylqxspcykekhj = new HashMap<>();
            //食品化妆品评审查验科
            Map sphzpspcykhj = new HashMap<>();

            //通过计划id，可以直接拿到预算表本计划的汇总
            List<NkYssbhj> nkYssbhjs = nkYssbhjService.list(new LambdaQueryWrapper<NkYssbhj>()
                    .eq(NkYssbhj::getFyssbjhid, jhid)
                    .eq(NkYssbhj::getFlx, OaCommonFlowConstant.HZBD_HZ));

            //各个部门的数据集合
            //办公室
            BigDecimal bgsclf = new BigDecimal(0);
            BigDecimal bgslwf = new BigDecimal(0);
            //企业组/数
            BigDecimal bgsqys = new BigDecimal(0);
            BigDecimal bgsclrs = new BigDecimal(0);
            BigDecimal bgsclts = new BigDecimal(0);
            BigDecimal bgszsts = new BigDecimal(0);
            BigDecimal bgsjtts = new BigDecimal(0);
            BigDecimal bgslwts = new BigDecimal(0);
            BigDecimal bgslwrc = new BigDecimal(0);


            //人教科
            BigDecimal rjkclf = new BigDecimal(0);
            BigDecimal rjklwf = new BigDecimal(0);

            BigDecimal rjkqys = new BigDecimal(0);
            BigDecimal rjkclrs = new BigDecimal(0);
            BigDecimal rjkclts = new BigDecimal(0);
            BigDecimal rjkzsts = new BigDecimal(0);
            BigDecimal rjkjtts = new BigDecimal(0);
            BigDecimal rjklwts = new BigDecimal(0);
            BigDecimal rjklwrc = new BigDecimal(0);


            //质量管理与科研科
            BigDecimal zlglykykclf = new BigDecimal(0);
            BigDecimal zlglykyklwf = new BigDecimal(0);


            BigDecimal zlglykykqys = new BigDecimal(0);
            BigDecimal zlglykykclrs = new BigDecimal(0);
            BigDecimal zlglykykclts = new BigDecimal(0);
            BigDecimal zlglykykzsts = new BigDecimal(0);
            BigDecimal zlglykykjtts = new BigDecimal(0);
            BigDecimal zlglykyklwts = new BigDecimal(0);
            BigDecimal zlglykyklwrc = new BigDecimal(0);


            //药品注册审评查验科
            //药品
            BigDecimal ypzcspcykclfyp = new BigDecimal(0);
            BigDecimal ypzcspcyklwfyp = new BigDecimal(0);

            BigDecimal ypzcspcykqysyp = new BigDecimal(0);
            BigDecimal ypzcspcykclrsyp = new BigDecimal(0);
            BigDecimal ypzcspcykcltsyp = new BigDecimal(0);
            BigDecimal ypzcspcykzstsyp = new BigDecimal(0);
            BigDecimal ypzcspcykjttsyp = new BigDecimal(0);
            BigDecimal ypzcspcyklwtsyp = new BigDecimal(0);
            BigDecimal ypzcspcyklwrcyp = new BigDecimal(0);


            //临床
            BigDecimal ypzcspcykclflc = new BigDecimal(0);
            BigDecimal ypzcspcyklwflc = new BigDecimal(0);

            BigDecimal ypzcspcykqyslc = new BigDecimal(0);
            BigDecimal ypzcspcykclrslc = new BigDecimal(0);
            BigDecimal ypzcspcykcltslc = new BigDecimal(0);
            BigDecimal ypzcspcykzstslc = new BigDecimal(0);
            BigDecimal ypzcspcykjttslc = new BigDecimal(0);
            BigDecimal ypzcspcyklwtslc = new BigDecimal(0);
            BigDecimal ypzcspcyklwrclc = new BigDecimal(0);


            //药品生产查验科
            BigDecimal ypsccykclf = new BigDecimal(0);
            BigDecimal ypsccyklwf = new BigDecimal(0);

            BigDecimal ypsccykqys = new BigDecimal(0);
            BigDecimal ypsccykclrs = new BigDecimal(0);
            BigDecimal ypsccykclts = new BigDecimal(0);
            BigDecimal ypsccykzsts = new BigDecimal(0);
            BigDecimal ypsccykjtts = new BigDecimal(0);
            BigDecimal ypsccyklwts = new BigDecimal(0);
            BigDecimal ypsccyklwrc = new BigDecimal(0);

            //药品流通查验科
            BigDecimal ypltcykclf = new BigDecimal(0);
            BigDecimal ypltcyklwf = new BigDecimal(0);

            BigDecimal ypltcykqys = new BigDecimal(0);
            BigDecimal ypltcykclrs = new BigDecimal(0);
            BigDecimal ypltcykclts = new BigDecimal(0);
            BigDecimal ypltcykzsts = new BigDecimal(0);
            BigDecimal ypltcykjtts = new BigDecimal(0);
            BigDecimal ypltcyklwts = new BigDecimal(0);
            BigDecimal ypltcyklwrc = new BigDecimal(0);


            //医疗器械审评查验1科
            BigDecimal ylqxspcykykclf = new BigDecimal(0);
            BigDecimal ylqxspcykyklwf = new BigDecimal(0);

            BigDecimal ylqxspcykykqys = new BigDecimal(0);
            BigDecimal ylqxspcykykclrs = new BigDecimal(0);
            BigDecimal ylqxspcykykclts = new BigDecimal(0);
            BigDecimal ylqxspcykykzsts = new BigDecimal(0);
            BigDecimal ylqxspcykykjtts = new BigDecimal(0);
            BigDecimal ylqxspcykyklwts = new BigDecimal(0);
            BigDecimal ylqxspcykyklwrc = new BigDecimal(0);


            //医疗器械审评查验2科
            BigDecimal ylqxspcykekclf = new BigDecimal(0);
            BigDecimal ylqxspcykeklwf = new BigDecimal(0);

            BigDecimal ylqxspcykekqys = new BigDecimal(0);
            BigDecimal ylqxspcykekclrs = new BigDecimal(0);
            BigDecimal ylqxspcykekclts = new BigDecimal(0);
            BigDecimal ylqxspcykekzsts = new BigDecimal(0);
            BigDecimal ylqxspcykekjtts = new BigDecimal(0);
            BigDecimal ylqxspcykeklwts = new BigDecimal(0);
            BigDecimal ylqxspcykeklwrc = new BigDecimal(0);


            //食品化妆品评审查验科
            BigDecimal sphzpspcykclf = new BigDecimal(0);
            BigDecimal sphzpspcyklwf = new BigDecimal(0);

            BigDecimal sphzpspcykqys = new BigDecimal(0);
            BigDecimal sphzpspcykclrs = new BigDecimal(0);
            BigDecimal sphzpspcykclts = new BigDecimal(0);
            BigDecimal sphzpspcykzsts = new BigDecimal(0);
            BigDecimal sphzpspcykjtts = new BigDecimal(0);
            BigDecimal sphzpspcyklwts = new BigDecimal(0);
            BigDecimal sphzpspcyklwrc = new BigDecimal(0);

            for (NkYssbhj nkYssbhj : nkYssbhjs) {
                BigDecimal fclfhjhValue = new BigDecimal(Optional.ofNullable(nkYssbhj.getFclfhjh()).orElse("0"));
                BigDecimal flwfxjValue = new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfxj()).orElse("0"));

                switch (nkYssbhj.getFksy()) {
                    case OaFlowConstant.KSMC_BGS:
                        bgsclf = bgsclf.add(fclfhjhValue);
                        bgslwf = bgslwf.add(flwfxjValue);
                        bgsqys = bgsqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        bgsclrs = bgsclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        bgsclts = bgsclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        bgszsts = bgszsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        bgsjtts = bgsjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        bgslwts = bgslwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        bgslwrc = bgslwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    case OaFlowConstant.KSMC_RJK:
                        rjkclf = rjkclf.add(fclfhjhValue);
                        rjklwf = rjklwf.add(flwfxjValue);
                        rjkqys = rjkqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        rjkclrs = rjkclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        rjkclts = rjkclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        rjkzsts = rjkzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        rjkjtts = rjkjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        rjklwts = rjklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        rjklwrc = rjklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));

                        break;
                    case OaFlowConstant.KSMC_ZLGLYKYK:
                        zlglykykclf = zlglykykclf.add(fclfhjhValue);
                        zlglykyklwf = zlglykyklwf.add(flwfxjValue);
                        zlglykykqys = zlglykykqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        zlglykykclrs = zlglykykclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        zlglykykclts = zlglykykclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        zlglykykzsts = zlglykykzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        zlglykykjtts = zlglykykjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        zlglykyklwts = zlglykyklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        zlglykyklwrc = zlglykyklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));

                        break;
                    case OaFlowConstant.KSMC_YPZCSPCYK:
                        if (nkYssbhj.getFkse().equals(OaFlowConstant.YPZC_YP)) {
                            ypzcspcykclfyp = ypzcspcykclfyp.add(fclfhjhValue);
                            ypzcspcyklwfyp = ypzcspcyklwfyp.add(flwfxjValue);
                            ypzcspcykqysyp = ypzcspcykqysyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                            ypzcspcykclrsyp = ypzcspcykclrsyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                            ypzcspcykcltsyp = ypzcspcykcltsyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                            ypzcspcykzstsyp = ypzcspcykzstsyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                            ypzcspcykjttsyp = ypzcspcykjttsyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                            ypzcspcyklwtsyp = ypzcspcyklwtsyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                            ypzcspcyklwrcyp = ypzcspcyklwrcyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        } else if (nkYssbhj.getFkse().equals(OaFlowConstant.YPZC_LC)) {
                            ypzcspcykclflc = ypzcspcykclflc.add(fclfhjhValue);
                            ypzcspcyklwflc = ypzcspcyklwflc.add(flwfxjValue);
                            ypzcspcykqyslc = ypzcspcykqyslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                            ypzcspcykclrslc = ypzcspcykclrslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                            ypzcspcykcltslc = ypzcspcykcltslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                            ypzcspcykzstslc = ypzcspcykzstslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                            ypzcspcykjttslc = ypzcspcykjttslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                            ypzcspcyklwtslc = ypzcspcyklwtslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                            ypzcspcyklwrclc = ypzcspcyklwrclc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));

                        }
                        break;

                    case OaFlowConstant.KSMC_YPSCCYK:
                        ypsccykclf = ypsccykclf.add(fclfhjhValue);
                        ypsccyklwf = ypsccyklwf.add(flwfxjValue);
                        ypsccykqys = ypsccykqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        ypsccykclrs = ypsccykclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        ypsccykclts = ypsccykclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        ypsccykzsts = ypsccykzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        ypsccykjtts = ypsccykjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        ypsccyklwts = ypsccyklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        ypsccyklwrc = ypsccyklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;

                    case OaFlowConstant.KSMC_YPLTCYK:
                        ypltcykclf = ypltcykclf.add(fclfhjhValue);
                        ypltcyklwf = ypltcyklwf.add(flwfxjValue);
                        ypltcykqys = ypltcykqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        ypltcykclrs = ypltcykclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        ypltcykclts = ypltcykclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        ypltcykzsts = ypltcykzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        ypltcykjtts = ypltcykjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        ypltcyklwts = ypltcyklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        ypltcyklwrc = ypltcyklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    case OaFlowConstant.KSMC_YLQXSPCYK_1:
                        ylqxspcykykclf = ylqxspcykykclf.add(fclfhjhValue);
                        ylqxspcykyklwf = ylqxspcykyklwf.add(flwfxjValue);
                        ylqxspcykykqys = ylqxspcykykqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        ylqxspcykykclrs = ylqxspcykykclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        ylqxspcykykclts = ylqxspcykykclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        ylqxspcykykzsts = ylqxspcykykzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        ylqxspcykykjtts = ylqxspcykykjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        ylqxspcykyklwts = ylqxspcykyklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        ylqxspcykyklwrc = ylqxspcykyklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    case OaFlowConstant.KSMC_YLQXSPCYK_2:
                        ylqxspcykekclf = ylqxspcykekclf.add(fclfhjhValue);
                        ylqxspcykeklwf = ylqxspcykeklwf.add(flwfxjValue);
                        ylqxspcykekqys = ylqxspcykekqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        ylqxspcykekclrs = ylqxspcykekclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        ylqxspcykekclts = ylqxspcykekclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        ylqxspcykekzsts = ylqxspcykekzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        ylqxspcykekjtts = ylqxspcykekjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        ylqxspcykeklwts = ylqxspcykeklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        ylqxspcykeklwrc = ylqxspcykeklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    case OaFlowConstant.KSMC_SPHZPPSCYK:
                        sphzpspcykclf = sphzpspcykclf.add(fclfhjhValue);
                        sphzpspcyklwf = sphzpspcyklwf.add(flwfxjValue);
                        sphzpspcykqys = sphzpspcykqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        sphzpspcykclrs = sphzpspcykclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        sphzpspcykclts = sphzpspcykclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        sphzpspcykzsts = sphzpspcykzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        sphzpspcykjtts = sphzpspcykjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        sphzpspcyklwts = sphzpspcyklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        sphzpspcyklwrc = sphzpspcyklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    default:
                        // 处理其他情况或无需处理
                        break;
                }
            }
            bgshj.put("name", "办公室");
            bgshj.put("clf", bgsclf);
            bgshj.put("lwf", bgslwf);
            bgshj.put("qys", bgsqys);
            bgshj.put("clrs", bgsclrs);
            bgshj.put("clts", bgsclts);
            bgshj.put("zsts", bgszsts);
            bgshj.put("jtts", bgsjtts);
            bgshj.put("lwts", bgslwts);
            bgshj.put("lwrc", bgslwrc);


            //人教科
            rjkhj.put("name", "人教科");
            rjkhj.put("clf", rjkclf);
            rjkhj.put("lwf", rjklwf);
            rjkhj.put("qys", rjkqys);
            rjkhj.put("clrs", rjkclrs);
            rjkhj.put("clts", rjkclts);
            rjkhj.put("zsts", rjkzsts);
            rjkhj.put("jtts", rjkjtts);
            rjkhj.put("lwts", rjklwts);
            rjkhj.put("lwrc", rjklwrc);

            //质量管理与科研科
            zlglykykhj.put("name", "质量管理与科研科");
            zlglykykhj.put("clf", zlglykykclf);
            zlglykykhj.put("lwf", zlglykyklwf);
            zlglykykhj.put("qys", zlglykykqys);
            zlglykykhj.put("clrs", zlglykykclrs);
            zlglykykhj.put("clts", zlglykykclts);
            zlglykykhj.put("zsts", zlglykykzsts);
            zlglykykhj.put("jtts", zlglykykjtts);
            zlglykykhj.put("lwts", zlglykyklwts);
            zlglykykhj.put("lwrc", zlglykyklwrc);


            //药品注册审评查验科合计
            HashMap ypzcspcykhj = new HashMap();
            ypzcspcykhj.put("name", "药品注册审评查验科");
            ypzcspcykhj.put("clf", ypzcspcykclfyp.add(ypzcspcykclflc));
            ypzcspcykhj.put("lwf", ypzcspcyklwfyp.add(ypzcspcyklwflc));
            ypzcspcykhj.put("qys", ypzcspcykqysyp.add(ypzcspcykqyslc));
            ypzcspcykhj.put("clrs", ypzcspcykclrsyp.add(ypzcspcykclrslc));
            ypzcspcykhj.put("clts", ypzcspcykcltsyp.add(ypzcspcykcltslc));
            ypzcspcykhj.put("zsts", ypzcspcykzstsyp.add(ypzcspcykzstslc));
            ypzcspcykhj.put("jtts", ypzcspcykjttsyp.add(ypzcspcykjttslc));
            ypzcspcykhj.put("lwts", ypzcspcyklwtsyp.add(ypzcspcyklwtslc));
            ypzcspcykhj.put("lwrc", ypzcspcyklwrcyp.add(ypzcspcyklwrclc));

            List yplist = new ArrayList<>();

            //药品注册审评查验科 药品
            ypzcspcykclfhjyp.put("name", "药品");
            ypzcspcykclfhjyp.put("clf", ypzcspcykclfyp);
            ypzcspcykclfhjyp.put("lwf", ypzcspcyklwfyp);
            ypzcspcykclfhjyp.put("qys", ypzcspcykqysyp);
            ypzcspcykclfhjyp.put("clrs", ypzcspcykclrsyp);
            ypzcspcykclfhjyp.put("clts", ypzcspcykcltsyp);
            ypzcspcykclfhjyp.put("zsts", ypzcspcykzstsyp);
            ypzcspcykclfhjyp.put("jtts", ypzcspcykjttsyp);
            ypzcspcykclfhjyp.put("lwts", ypzcspcyklwtsyp);
            ypzcspcykclfhjyp.put("lwrc", ypzcspcyklwrcyp);

            //药品注册审评查验科 临床
            ypzcspcykclfhjlc.put("name", "临床");
            ypzcspcykclfhjlc.put("clf", ypzcspcykclflc);
            ypzcspcykclfhjlc.put("lwf", ypzcspcyklwflc);
            ypzcspcykclfhjlc.put("qys", ypzcspcykqyslc);
            ypzcspcykclfhjlc.put("clrs", ypzcspcykclrslc);
            ypzcspcykclfhjlc.put("clts", ypzcspcykcltslc);
            ypzcspcykclfhjlc.put("zsts", ypzcspcykzstslc);
            ypzcspcykclfhjlc.put("jtts", ypzcspcykjttslc);
            ypzcspcykclfhjlc.put("lwts", ypzcspcyklwtslc);
            ypzcspcykclfhjlc.put("lwrc", ypzcspcyklwrclc);


            yplist.add(ypzcspcykclfhjyp);
            yplist.add(ypzcspcykclfhjlc);


            ypzcspcykhj.put("list", yplist);


            //药品生产查验科
            ypsccykhj.put("name", "药品生产查验科");
            ypsccykhj.put("clf", ypsccykclf);
            ypsccykhj.put("lwf", ypsccyklwf);
            ypsccykhj.put("qys", ypsccykqys);
            ypsccykhj.put("clrs", ypsccykclrs);
            ypsccykhj.put("clts", ypsccykclts);
            ypsccykhj.put("zsts", ypsccykzsts);
            ypsccykhj.put("jtts", ypsccykjtts);
            ypsccykhj.put("lwts", ypsccyklwts);
            ypsccykhj.put("lwrc", ypsccyklwrc);
            //药品流通查验科
            ypltcykhj.put("name", "药品流通查验科");
            ypltcykhj.put("clf", ypltcykclf);
            ypltcykhj.put("lwf", ypltcyklwf);
            ypltcykhj.put("qys", ypltcykqys);
            ypltcykhj.put("clrs", ypltcykclrs);
            ypltcykhj.put("clts", ypltcykclts);
            ypltcykhj.put("zsts", ypltcykzsts);
            ypltcykhj.put("jtts", ypltcykjtts);
            ypltcykhj.put("lwts", ypltcyklwts);
            ypltcykhj.put("lwrc", ypltcyklwrc);
            //医疗器械审评查验1科
            ylqxspcykykhj.put("name", "医疗器械审评查验1科");
            ylqxspcykykhj.put("clf", ylqxspcykykclf);
            ylqxspcykykhj.put("lwf", ylqxspcykyklwf);
            ylqxspcykykhj.put("qys", ylqxspcykykqys);
            ylqxspcykykhj.put("clrs", ylqxspcykykclrs);
            ylqxspcykykhj.put("clts", ylqxspcykykclts);
            ylqxspcykykhj.put("zsts", ylqxspcykykzsts);
            ylqxspcykykhj.put("jtts", ylqxspcykykjtts);
            ylqxspcykykhj.put("lwts", ylqxspcykyklwts);
            ylqxspcykykhj.put("lwrc", ylqxspcykyklwrc);
            //医疗器械审评查验2科
            ylqxspcykekhj.put("name", "医疗器械审评查验2科");
            ylqxspcykekhj.put("clf", ylqxspcykekclf);
            ylqxspcykekhj.put("lwf", ylqxspcykeklwf);
            ylqxspcykekhj.put("qys", ylqxspcykekqys);
            ylqxspcykekhj.put("clrs", ylqxspcykekclrs);
            ylqxspcykekhj.put("clts", ylqxspcykekclts);
            ylqxspcykekhj.put("zsts", ylqxspcykekzsts);
            ylqxspcykekhj.put("jtts", ylqxspcykekjtts);
            ylqxspcykekhj.put("lwts", ylqxspcykeklwts);
            ylqxspcykekhj.put("lwrc", ylqxspcykeklwrc);
            //食品化妆品评审查验科
            sphzpspcykhj.put("name", "食品化妆品评审查验科");
            sphzpspcykhj.put("clf", sphzpspcykclf);
            sphzpspcykhj.put("lwf", sphzpspcyklwf);
            sphzpspcykhj.put("qys", sphzpspcykqys);
            sphzpspcykhj.put("clrs", sphzpspcykclrs);
            sphzpspcykhj.put("clts", sphzpspcykclts);
            sphzpspcykhj.put("zsts", sphzpspcykzsts);
            sphzpspcykhj.put("jtts", sphzpspcykjtts);
            sphzpspcykhj.put("lwts", sphzpspcyklwts);
            sphzpspcykhj.put("lwrc", sphzpspcyklwrc);

            //总计
            HashMap zjmap = new HashMap();
            zjmap.put("name", "总计");
            zjmap.put("clf", bgsclf.add(rjkclf).add(zlglykykclf).add(ypzcspcykclfyp).add(ypzcspcykclflc)
                    .add(ypsccykclf).add(ypltcykclf).add(ylqxspcykykclf).add(ylqxspcykekclf).add(sphzpspcykclf));
            zjmap.put("lwf", bgslwf.add(rjklwf).add(zlglykyklwf).add(ypzcspcyklwfyp).add(ypzcspcyklwflc)
                    .add(ypsccyklwf).add(ypltcyklwf).add(ylqxspcykyklwf).add(ylqxspcykeklwf).add(sphzpspcyklwf));
            zjmap.put("qys", bgsqys.add(rjkqys).add(zlglykykqys).add(ypzcspcykqysyp).add(ypzcspcykqyslc)
                    .add(ypsccykqys).add(ypltcykqys).add(ylqxspcykykqys).add(ylqxspcykekqys).add(sphzpspcykqys));
            zjmap.put("clrs", bgsclrs.add(rjkclrs).add(zlglykykclrs).add(ypzcspcykclrsyp).add(ypzcspcykclrslc)
                    .add(ypsccykclrs).add(ypltcykclrs).add(ylqxspcykykclrs).add(ylqxspcykekclrs).add(sphzpspcykclrs));
            zjmap.put("clts", bgsclts.add(rjkclts).add(zlglykykclts).add(ypzcspcykcltsyp).add(ypzcspcykcltslc)
                    .add(ypsccykclts).add(ypltcykclts).add(ylqxspcykykclts).add(ylqxspcykekclts).add(sphzpspcykclts));
            zjmap.put("zsts", bgszsts.add(rjkzsts).add(zlglykykzsts).add(ypzcspcykzstsyp).add(ypzcspcykzstslc)
                    .add(ypsccykzsts).add(ypltcykzsts).add(ylqxspcykykzsts).add(ylqxspcykekzsts).add(sphzpspcykzsts));
            zjmap.put("jtts", bgsjtts.add(rjkjtts).add(zlglykykjtts).add(ypzcspcykjttsyp).add(ypzcspcykjttslc)
                    .add(ypsccykjtts).add(ypltcykjtts).add(ylqxspcykykjtts).add(ylqxspcykekjtts).add(sphzpspcykjtts));
            zjmap.put("lwts", bgslwts.add(rjklwts).add(zlglykyklwts).add(ypzcspcyklwtsyp).add(ypzcspcyklwtslc)
                    .add(ypsccyklwts).add(ypltcyklwts).add(ylqxspcykyklwts).add(ylqxspcykeklwts).add(sphzpspcyklwts));
            zjmap.put("lwrc", bgslwrc.add(rjklwrc).add(zlglykyklwrc).add(ypzcspcyklwrcyp).add(ypzcspcyklwrclc)
                    .add(ypsccyklwrc).add(ypltcyklwrc).add(ylqxspcykyklwrc).add(ylqxspcykeklwrc).add(sphzpspcyklwrc));


            List allList = new ArrayList<>();
            allList.add(bgshj);
            allList.add(rjkhj);
            allList.add(zlglykykhj);

            allList.add(ypzcspcykhj);
            allList.add(ypsccykhj);
            allList.add(ypltcykhj);
            allList.add(ylqxspcykykhj);
            allList.add(ylqxspcykekhj);
            allList.add(sphzpspcykhj);
            allList.add(zjmap);
            return allList;
        }

        if (jclx.equals(OaCommonFlowConstant.XMNR_KT)) {
            //办公室
            Map bgshj = new HashMap<>();
            //人教科
            Map rjkhj = new HashMap<>();
            //质量管理与科研科
            Map zlglykykhj = new HashMap<>();

            HashMap ypzcspcykhj = new HashMap();
            //药品生产查验科
            Map ypsccykhj = new HashMap<>();
            //药品流通查验科
            Map ypltcykhj = new HashMap<>();
            //医疗器械审评查验1科
            Map ylqxspcykykhj = new HashMap<>();
            //医疗器械审评查验2科
            Map ylqxspcykekhj = new HashMap<>();
            //食品化妆品评审查验科
            Map sphzpspcykhj = new HashMap<>();

            //通过计划id，可以直接拿到预算表本计划的汇总
            List<NkYssbhjKt> nkYssbhjKts = nkYssbhjKtService.list(new LambdaQueryWrapper<NkYssbhjKt>()
                    .eq(NkYssbhjKt::getFyssbjhid, jhid)
                    .eq(NkYssbhjKt::getFlx, OaCommonFlowConstant.HZBD_HZ));

            //各个部门的数据集合
            //办公室
            BigDecimal bgsclf = new BigDecimal(0);

            //人教科
            BigDecimal rjkclf = new BigDecimal(0);

            //质量管理与科研科
            BigDecimal zlglykykclf = new BigDecimal(0);

            //药品注册审评查验科
            BigDecimal ypzcspcykclf = new BigDecimal(0);


            //药品生产查验科
            BigDecimal ypsccykclf = new BigDecimal(0);

            //药品流通查验科
            BigDecimal ypltcykclf = new BigDecimal(0);

            //医疗器械审评查验1科
            BigDecimal ylqxspcykykclf = new BigDecimal(0);

            //医疗器械审评查验2科
            BigDecimal ylqxspcykekclf = new BigDecimal(0);

            //食品化妆品评审查验科
            BigDecimal sphzpspcykclf = new BigDecimal(0);


            for (NkYssbhjKt nkYssbhjKt : nkYssbhjKts) {
                BigDecimal fktjf = new BigDecimal(Optional.ofNullable(nkYssbhjKt.getFktjf()).orElse("0"));


                switch (nkYssbhjKt.getFktfzks()) {
                    case OaFlowConstant.KSMC_BGS:
                        bgsclf = bgsclf.add(fktjf);
                        break;
                    case OaFlowConstant.KSMC_RJK:
                        rjkclf = rjkclf.add(fktjf);


                        break;
                    case OaFlowConstant.KSMC_ZLGLYKYK:
                        zlglykykclf = zlglykykclf.add(fktjf);
                        break;
                    case OaFlowConstant.KSMC_YPZCSPCYK:
                        ypzcspcykclf = ypzcspcykclf.add(fktjf);
                        break;

                    case OaFlowConstant.KSMC_YPSCCYK:
                        ypsccykclf = ypsccykclf.add(fktjf);
                        break;
                    case OaFlowConstant.KSMC_YPLTCYK:
                        ypltcykclf = ypltcykclf.add(fktjf);
                        break;
                    case OaFlowConstant.KSMC_YLQXSPCYK_1:
                        ylqxspcykykclf = ylqxspcykykclf.add(fktjf);
                        break;
                    case OaFlowConstant.KSMC_YLQXSPCYK_2:
                        ylqxspcykekclf = ylqxspcykekclf.add(fktjf);
                        break;
                    case OaFlowConstant.KSMC_SPHZPPSCYK:
                        sphzpspcykclf = sphzpspcykclf.add(fktjf);
                        break;
                    default:
                        // 处理其他情况或无需处理
                        break;
                }
            }
            bgshj.put("name", "办公室");
            bgshj.put("ktjf", bgsclf);

            //人教科
            rjkhj.put("name", "人教科");
            rjkhj.put("ktjf", rjkclf);


            //质量管理与科研科
            zlglykykhj.put("name", "质量管理与科研科");
            zlglykykhj.put("ktjf", zlglykykclf);

            //药品注册审评查验科合计
            ypzcspcykhj.put("name", "药品注册审评查验科");
            ypzcspcykhj.put("ktjf", ypzcspcykclf);


            //药品生产查验科
            ypsccykhj.put("name", "药品生产查验科");
            ypsccykhj.put("ktjf", ypsccykclf);

            //药品流通查验科
            ypltcykhj.put("name", "药品流通查验科");
            ypltcykhj.put("ktjf", ypltcykclf);

            //医疗器械审评查验1科
            ylqxspcykykhj.put("name", "医疗器械审评查验1科");
            ylqxspcykykhj.put("ktjf", ylqxspcykykclf);

            //医疗器械审评查验2科
            ylqxspcykekhj.put("name", "医疗器械审评查验2科");
            ylqxspcykekhj.put("ktjf", ylqxspcykekclf);

            //食品化妆品评审查验科
            sphzpspcykhj.put("name", "食品化妆品评审查验科");
            sphzpspcykhj.put("ktjf", sphzpspcykclf);


            //总计
            HashMap zjmap = new HashMap();
            zjmap.put("name", "总计");
            zjmap.put("ktjf", bgsclf.add(rjkclf).add(zlglykykclf).add(ypzcspcykclf)
                    .add(ypsccykclf).add(ypltcykclf).add(ylqxspcykykclf).add(ylqxspcykekclf).add(sphzpspcykclf));


            List allList = new ArrayList<>();
            allList.add(bgshj);
            allList.add(rjkhj);
            allList.add(zlglykykhj);

            allList.add(ypzcspcykhj);
            allList.add(ypsccykhj);
            allList.add(ypltcykhj);
            allList.add(ylqxspcykykhj);
            allList.add(ylqxspcykekhj);
            allList.add(sphzpspcykhj);
            allList.add(zjmap);
            return allList;
        }

        if (jclx.equals(OaCommonFlowConstant.XMNR_YS)) {
            //办公室
            Map bgshj = new HashMap<>();
            //人教科
            Map rjkhj = new HashMap<>();
            //质量管理与科研科
            Map zlglykykhj = new HashMap<>();

            HashMap ypzcspcykhj = new HashMap();
            //药品生产查验科
            Map ypsccykhj = new HashMap<>();
            //药品流通查验科
            Map ypltcykhj = new HashMap<>();
            //医疗器械审评查验1科
            Map ylqxspcykykhj = new HashMap<>();
            //医疗器械审评查验2科
            Map ylqxspcykekhj = new HashMap<>();
            //食品化妆品评审查验科
            Map sphzpspcykhj = new HashMap<>();

            //通过计划id，可以直接拿到预算表本计划的汇总
            List<NkYssbhjys> nkYssbhjys = nkYssbhjysService.list(new LambdaQueryWrapper<NkYssbhjys>()
                    .eq(NkYssbhjys::getFyssbjhid, jhid)
                    .eq(NkYssbhjys::getFlx, OaCommonFlowConstant.HZBD_HZ));

            //各个部门的数据集合
            //办公室
            BigDecimal bgsclf = new BigDecimal(0);

            //人教科
            BigDecimal rjkclf = new BigDecimal(0);

            //质量管理与科研科
            BigDecimal zlglykykclf = new BigDecimal(0);

            //药品注册审评查验科
            BigDecimal ypzcspcykclf = new BigDecimal(0);


            //药品生产查验科
            BigDecimal ypsccykclf = new BigDecimal(0);

            //药品流通查验科
            BigDecimal ypltcykclf = new BigDecimal(0);

            //医疗器械审评查验1科
            BigDecimal ylqxspcykykclf = new BigDecimal(0);

            //医疗器械审评查验2科
            BigDecimal ylqxspcykekclf = new BigDecimal(0);

            //食品化妆品评审查验科
            BigDecimal sphzpspcykclf = new BigDecimal(0);


            for (NkYssbhjys nkYssbhjys1 : nkYssbhjys) {
                BigDecimal fysf = new BigDecimal(Optional.ofNullable(nkYssbhjys1.getFyzhj()).orElse("0"));


                switch (nkYssbhjys1.getFks()) {
                    case OaFlowConstant.KSMC_BGS:
                        bgsclf = bgsclf.add(fysf);
                        break;
                    case OaFlowConstant.KSMC_RJK:
                        rjkclf = rjkclf.add(fysf);
                        break;
                    case OaFlowConstant.KSMC_ZLGLYKYK:
                        zlglykykclf = zlglykykclf.add(fysf);
                        break;
                    case OaFlowConstant.KSMC_YPZCSPCYK:
                        ypzcspcykclf = ypzcspcykclf.add(fysf);
                        break;
                    case OaFlowConstant.KSMC_YPSCCYK:
                        ypsccykclf = ypsccykclf.add(fysf);
                        break;
                    case OaFlowConstant.KSMC_YPLTCYK:
                        ypltcykclf = ypltcykclf.add(fysf);
                        break;
                    case OaFlowConstant.KSMC_YLQXSPCYK_1:
                        ylqxspcykykclf = ylqxspcykykclf.add(fysf);
                        break;
                    case OaFlowConstant.KSMC_YLQXSPCYK_2:
                        ylqxspcykekclf = ylqxspcykekclf.add(fysf);
                        break;
                    case OaFlowConstant.KSMC_SPHZPPSCYK:
                        sphzpspcykclf = sphzpspcykclf.add(fysf);
                        break;
                    default:
                        // 处理其他情况或无需处理
                        break;
                }
            }
            bgshj.put("name", "办公室");
            bgshj.put("ysf", bgsclf);

            //人教科
            rjkhj.put("name", "人教科");
            rjkhj.put("ysf", rjkclf);


            //质量管理与科研科
            zlglykykhj.put("name", "质量管理与科研科");
            zlglykykhj.put("ysf", zlglykykclf);

            //药品注册审评查验科合计
            ypzcspcykhj.put("name", "药品注册审评查验科");
            ypzcspcykhj.put("ysf", ypzcspcykclf);


            //药品生产查验科
            ypsccykhj.put("name", "药品生产查验科");
            ypsccykhj.put("ysf", ypsccykclf);

            //药品流通查验科
            ypltcykhj.put("name", "药品流通查验科");
            ypltcykhj.put("ysf", ypltcykclf);

            //医疗器械审评查验1科
            ylqxspcykykhj.put("name", "医疗器械审评查验1科");
            ylqxspcykykhj.put("ysf", ylqxspcykykclf);

            //医疗器械审评查验2科
            ylqxspcykekhj.put("name", "医疗器械审评查验2科");
            ylqxspcykekhj.put("ysf", ylqxspcykekclf);

            //食品化妆品评审查验科
            sphzpspcykhj.put("name", "食品化妆品评审查验科");
            sphzpspcykhj.put("ysf", sphzpspcykclf);


            //总计
            HashMap zjmap = new HashMap();
            zjmap.put("name", "总计");
            zjmap.put("ysf", bgsclf.add(rjkclf).add(zlglykykclf).add(ypzcspcykclf)
                    .add(ypsccykclf).add(ypltcykclf).add(ylqxspcykykclf).add(ylqxspcykekclf).add(sphzpspcykclf));


            List allList = new ArrayList<>();
            allList.add(bgshj);
            allList.add(rjkhj);
            allList.add(zlglykykhj);

            allList.add(ypzcspcykhj);
            allList.add(ypsccykhj);
            allList.add(ypltcykhj);
            allList.add(ylqxspcykykhj);
            allList.add(ylqxspcykekhj);
            allList.add(sphzpspcykhj);
            allList.add(zjmap);
            return allList;
        }

        if (jclx.equals(OaCommonFlowConstant.XMNR_PX)) {
            //办公室
            Map bgshj = new HashMap<>();
            //人教科
            Map rjkhj = new HashMap<>();
            //质量管理与科研科
            Map zlglykykhj = new HashMap<>();

            HashMap ypzcspcykhj = new HashMap();
            //药品生产查验科
            Map ypsccykhj = new HashMap<>();
            //药品流通查验科
            Map ypltcykhj = new HashMap<>();
            //医疗器械审评查验1科
            Map ylqxspcykykhj = new HashMap<>();
            //医疗器械审评查验2科
            Map ylqxspcykekhj = new HashMap<>();
            //食品化妆品评审查验科
            Map sphzpspcykhj = new HashMap<>();

            //通过计划id，可以直接拿到预算表本计划的汇总
            List<NkYssbhjPx> nkYssbhjPX = nkYssbhjpxService.list(new LambdaQueryWrapper<NkYssbhjPx>()
                    .eq(NkYssbhjPx::getFyssbjhid, jhid)
                    .eq(NkYssbhjPx::getFlx, OaCommonFlowConstant.HZBD_HZ));

            //各个部门的数据集合
            //办公室
            //培训人数 培训费 师资小计 合计
            BigDecimal bgspxrs = new BigDecimal(0);
            BigDecimal bgspxf = new BigDecimal(0);
            BigDecimal bgsszxj = new BigDecimal(0);
            BigDecimal bgspxhj = new BigDecimal(0);


            //人教科
            BigDecimal rjkpxrs = new BigDecimal(0);
            BigDecimal rjkpxf = new BigDecimal(0);
            BigDecimal rjkszxj = new BigDecimal(0);
            BigDecimal rjkszxjhj = new BigDecimal(0);

            //质量管理与科研科
            BigDecimal zlglykykpxrs = new BigDecimal(0);
            BigDecimal zlglykykpxf = new BigDecimal(0);
            BigDecimal zlglykykpxzxj = new BigDecimal(0);
            BigDecimal zlglykykpxzxjhj = new BigDecimal(0);


            //药品注册审评查验科
            BigDecimal ypzcspcykpxrs = new BigDecimal(0);
            BigDecimal ypzcspcykpxf = new BigDecimal(0);
            BigDecimal ypzcspcykpxzxj = new BigDecimal(0);
            BigDecimal ypzcspcykpxzxjhj = new BigDecimal(0);


            //药品生产查验科
            BigDecimal ypsccykpxrs = new BigDecimal(0);
            BigDecimal ypsccykpxf = new BigDecimal(0);
            BigDecimal ypsccykpxzxj = new BigDecimal(0);
            BigDecimal ypsccykpxzxjhj = new BigDecimal(0);

            //药品流通查验科
            BigDecimal ypltcykcpxrs = new BigDecimal(0);
            BigDecimal ypltcykcpxf = new BigDecimal(0);
            BigDecimal ypltcykcpxzxj = new BigDecimal(0);
            BigDecimal ypltcykcpxzxjhj = new BigDecimal(0);

            //医疗器械审评查验1科
            BigDecimal ylqxspcykykpxrs = new BigDecimal(0);
            BigDecimal ylqxspcykykpxf = new BigDecimal(0);
            BigDecimal ylqxspcykykpxzxj = new BigDecimal(0);
            BigDecimal ylqxspcykykpxzxjhj = new BigDecimal(0);

            //医疗器械审评查验2科
            BigDecimal ylqxspcykekpxrs = new BigDecimal(0);
            BigDecimal ylqxspcykekpxf = new BigDecimal(0);
            BigDecimal ylqxspcykekpxzxj = new BigDecimal(0);
            BigDecimal ylqxspcykekpxzxjhj = new BigDecimal(0);

            //食品化妆品评审查验科
            BigDecimal sphzpspcykpxrs = new BigDecimal(0);
            BigDecimal sphzpspcykpxf = new BigDecimal(0);
            BigDecimal sphzpspcykpxzxj = new BigDecimal(0);
            BigDecimal sphzpspcykpxzxjhj = new BigDecimal(0);


            for (NkYssbhjPx nkYssbhjys1 : nkYssbhjPX) {
                BigDecimal fpxrs = new BigDecimal(Optional.ofNullable(nkYssbhjys1.getFpxrs()).orElse("0"));
                BigDecimal fpxfy = new BigDecimal(Optional.ofNullable(nkYssbhjys1.getFpxfy()).orElse("0"));
                BigDecimal fskf = new BigDecimal(Optional.ofNullable(nkYssbhjys1.getFskf()).orElse("0"));
                BigDecimal fpxskxj = new BigDecimal(Optional.ofNullable(nkYssbhjys1.getFpxskxj()).orElse("0"));


                switch (nkYssbhjys1.getFks()) {
                    case OaFlowConstant.KSMC_BGS:
                        bgspxrs = bgspxrs.add(fpxrs);
                        bgspxf = bgspxf.add(fpxfy);
                        bgsszxj = bgsszxj.add(fskf);
                        bgspxhj = bgspxhj.add(fpxskxj);
                        break;
                    case OaFlowConstant.KSMC_RJK:
                        rjkpxrs = rjkpxrs.add(fpxrs);
                        rjkpxf = rjkpxf.add(fpxfy);
                        rjkszxj = rjkszxj.add(fskf);
                        rjkszxjhj = rjkszxjhj.add(fpxskxj);

                        break;
                    case OaFlowConstant.KSMC_ZLGLYKYK:
                        zlglykykpxrs = zlglykykpxrs.add(fpxrs);
                        zlglykykpxf = zlglykykpxf.add(fpxfy);
                        zlglykykpxzxj = zlglykykpxzxj.add(fskf);
                        zlglykykpxzxjhj = zlglykykpxzxjhj.add(fpxskxj);

                        break;
                    case OaFlowConstant.KSMC_YPZCSPCYK:
                        ypzcspcykpxrs = ypzcspcykpxrs.add(fpxrs);
                        ypzcspcykpxf = ypzcspcykpxf.add(fpxfy);
                        ypzcspcykpxzxj = ypzcspcykpxzxj.add(fskf);
                        ypzcspcykpxzxjhj = ypzcspcykpxzxjhj.add(fpxskxj);


                        break;
                    case OaFlowConstant.KSMC_YPSCCYK:
                        ypsccykpxrs = ypsccykpxrs.add(fpxrs);
                        ypsccykpxf = ypsccykpxf.add(fpxfy);
                        ypsccykpxzxj = ypsccykpxzxj.add(fskf);
                        ypsccykpxzxjhj = ypsccykpxzxjhj.add(fpxskxj);

                        break;
                    case OaFlowConstant.KSMC_YPLTCYK:
                        ypltcykcpxrs = ypltcykcpxrs.add(fpxrs);
                        ypltcykcpxf = ypltcykcpxf.add(fpxfy);
                        ypltcykcpxzxj = ypltcykcpxzxj.add(fskf);
                        ypltcykcpxzxjhj = ypltcykcpxzxjhj.add(fpxskxj);

                        break;
                    case OaFlowConstant.KSMC_YLQXSPCYK_1:
                        ylqxspcykykpxrs = ylqxspcykykpxrs.add(fpxrs);
                        ylqxspcykykpxf = ylqxspcykykpxf.add(fpxfy);
                        ylqxspcykykpxzxj = ylqxspcykykpxzxj.add(fskf);
                        ylqxspcykykpxzxjhj = ylqxspcykykpxzxjhj.add(fpxskxj);

                        break;
                    case OaFlowConstant.KSMC_YLQXSPCYK_2:
                        ylqxspcykekpxrs = ylqxspcykekpxrs.add(fpxrs);
                        ylqxspcykekpxf = ylqxspcykekpxf.add(fpxfy);
                        ylqxspcykekpxzxj = ylqxspcykekpxzxj.add(fskf);
                        ylqxspcykekpxzxjhj = ylqxspcykekpxzxjhj.add(fpxskxj);

                        break;
                    case OaFlowConstant.KSMC_SPHZPPSCYK:
                        sphzpspcykpxrs = sphzpspcykpxrs.add(fpxrs);
                        sphzpspcykpxf = sphzpspcykpxf.add(fpxfy);
                        sphzpspcykpxzxj = sphzpspcykpxzxj.add(fskf);
                        sphzpspcykpxzxjhj = sphzpspcykpxzxjhj.add(fpxskxj);

                        break;
                    default:
                        // 处理其他情况或无需处理
                        break;
                }
            }
            bgshj.put("name", "办公室");
            bgshj.put("pxrs", bgspxrs);
            bgshj.put("pxf", bgspxf);
            bgshj.put("szfy", bgsszxj);
            bgshj.put("pxhj", bgspxhj);

            //人教科
            rjkhj.put("name", "人教科");
            rjkhj.put("pxrs", rjkpxrs);
            rjkhj.put("pxf", rjkpxf);
            rjkhj.put("szfy", rjkszxj);
            rjkhj.put("pxhj", rjkszxjhj);


            //质量管理与科研科
            zlglykykhj.put("name", "质量管理与科研科");
            zlglykykhj.put("pxrs", zlglykykpxrs);
            zlglykykhj.put("pxf", zlglykykpxf);
            zlglykykhj.put("szfy", zlglykykpxzxj);
            zlglykykhj.put("pxhj", zlglykykpxzxjhj);


            //药品注册审评查验科合计
            ypzcspcykhj.put("name", "药品注册审评查验科");
            ypzcspcykhj.put("pxrs", ypzcspcykpxrs);
            ypzcspcykhj.put("pxf", ypzcspcykpxf);
            ypzcspcykhj.put("szfy", ypzcspcykpxzxj);
            ypzcspcykhj.put("pxhj", ypzcspcykpxzxjhj);


            //药品生产查验科
            ypsccykhj.put("name", "药品生产查验科");
            ypsccykhj.put("pxrs", ypsccykpxrs);
            ypsccykhj.put("pxf", ypsccykpxf);
            ypsccykhj.put("szfy", ypsccykpxzxj);
            ypsccykhj.put("pxhj", ypsccykpxzxjhj);


            //药品流通查验科
            ypltcykhj.put("name", "药品流通查验科");
            ypltcykhj.put("pxrs", ypltcykcpxrs);
            ypltcykhj.put("pxf", ypltcykcpxf);
            ypltcykhj.put("szfy", ypltcykcpxzxj);
            ypltcykhj.put("pxhj", ypltcykcpxzxjhj);


            //医疗器械审评查验1科
            ylqxspcykykhj.put("name", "医疗器械审评查验1科");
            ylqxspcykykhj.put("pxrs", ylqxspcykykpxrs);
            ylqxspcykykhj.put("pxf", ylqxspcykekpxf);
            ylqxspcykykhj.put("szfy", ylqxspcykykpxzxj);
            ylqxspcykekhj.put("pxhj", ylqxspcykekpxzxjhj);


            //医疗器械审评查验2科
            ylqxspcykekhj.put("name", "医疗器械审评查验2科");
            ylqxspcykekhj.put("pxrs", ylqxspcykekpxrs);
            ylqxspcykekhj.put("pxf", ylqxspcykekpxf);
            ylqxspcykekhj.put("szfy", ylqxspcykekpxzxj);
            ylqxspcykekhj.put("pxhj", ylqxspcykekpxzxjhj);


            //食品化妆品评审查验科
            sphzpspcykhj.put("name", "食品化妆品评审查验科");
            sphzpspcykhj.put("pxrs", sphzpspcykpxrs);
            sphzpspcykhj.put("pxf", sphzpspcykpxf);
            sphzpspcykhj.put("szfy", sphzpspcykpxzxj);
            sphzpspcykhj.put("pxhj", sphzpspcykpxzxjhj);


            //总计
            HashMap zjmap = new HashMap();
            zjmap.put("name", "总计");
            zjmap.put("pxrs", bgspxrs.add(rjkpxrs).add(zlglykykpxrs).add(ypzcspcykpxrs).add(ypsccykpxrs)
                    .add(ypltcykcpxrs).add(ylqxspcykykpxrs).add(ylqxspcykekpxrs).add(sphzpspcykpxrs));
            zjmap.put("pxf", bgspxf.add(rjkpxf).add(zlglykykpxf).add(ypzcspcykpxf).add(ypsccykpxf)
                    .add(ypltcykcpxf).add(ylqxspcykykpxf).add(ylqxspcykekpxf).add(sphzpspcykpxf));
            zjmap.put("szfy", bgsszxj.add(rjkszxj).add(zlglykykpxzxj).add(ypzcspcykpxzxj).add(ypsccykpxzxj)
                    .add(ypltcykcpxzxj).add(ylqxspcykykpxzxj).add(ylqxspcykekpxzxj).add(sphzpspcykpxzxj));
            zjmap.put("pxhj", bgspxhj.add(rjkszxjhj).add(zlglykykpxzxjhj).add(ypzcspcykpxzxjhj).add(ypsccykpxzxjhj)
                    .add(ypltcykcpxzxjhj).add(ylqxspcykykpxzxjhj).add(ylqxspcykekpxzxjhj).add(sphzpspcykpxzxjhj));


            List allList = new ArrayList<>();
            allList.add(bgshj);
            allList.add(rjkhj);
            allList.add(zlglykykhj);

            allList.add(ypzcspcykhj);
            allList.add(ypsccykhj);
            allList.add(ypltcykhj);
            allList.add(ylqxspcykykhj);
            allList.add(ylqxspcykekhj);
            allList.add(sphzpspcykhj);
            allList.add(zjmap);
            return allList;
        }

        return null;
    }


    public List firstJs(String jhid, String jclx,String bm) {
        //多个部门的合计 map ，最后再用list全部放进去
        if (jclx.equals(OaCommonFlowConstant.XMNR_JC)) {
            //办公室
            Map bgshj = new HashMap<>();
            //人教科
            Map rjkhj = new HashMap<>();
            //质量管理与科研科
            Map zlglykykhj = new HashMap<>();

            //药品注册审评查验科
            //药品
            Map ypzcspcykclfhjyp = new HashMap<>();
            //临床
            Map ypzcspcykclfhjlc = new HashMap<>();

            //药品生产查验科
            Map ypsccykhj = new HashMap<>();
            //药品流通查验科
            Map ypltcykhj = new HashMap<>();
            //医疗器械审评查验1科
            Map ylqxspcykykhj = new HashMap<>();
            //医疗器械审评查验2科
            Map ylqxspcykekhj = new HashMap<>();
            //食品化妆品评审查验科
            Map sphzpspcykhj = new HashMap<>();

            //通过计划id，可以直接拿到预算表本计划的汇总
            List<NkYssbhj> nkYssbhjs = nkYssbhjService.list(new LambdaQueryWrapper<NkYssbhj>()
                    .eq(NkYssbhj::getFyssbjhid, jhid)
                    .eq(NkYssbhj::getFlx, OaCommonFlowConstant.HZBD_HZ)
                    .eq(NkYssbhj::getFksy, bm));

            //各个部门的数据集合
            //办公室
            BigDecimal bgsclf = new BigDecimal(0);
            BigDecimal bgslwf = new BigDecimal(0);
            //企业组/数
            BigDecimal bgsqys = new BigDecimal(0);
            BigDecimal bgsclrs = new BigDecimal(0);
            BigDecimal bgsclts = new BigDecimal(0);
            BigDecimal bgszsts = new BigDecimal(0);
            BigDecimal bgsjtts = new BigDecimal(0);
            BigDecimal bgslwts = new BigDecimal(0);
            BigDecimal bgslwrc = new BigDecimal(0);


            //人教科
            BigDecimal rjkclf = new BigDecimal(0);
            BigDecimal rjklwf = new BigDecimal(0);

            BigDecimal rjkqys = new BigDecimal(0);
            BigDecimal rjkclrs = new BigDecimal(0);
            BigDecimal rjkclts = new BigDecimal(0);
            BigDecimal rjkzsts = new BigDecimal(0);
            BigDecimal rjkjtts = new BigDecimal(0);
            BigDecimal rjklwts = new BigDecimal(0);
            BigDecimal rjklwrc = new BigDecimal(0);


            //质量管理与科研科
            BigDecimal zlglykykclf = new BigDecimal(0);
            BigDecimal zlglykyklwf = new BigDecimal(0);


            BigDecimal zlglykykqys = new BigDecimal(0);
            BigDecimal zlglykykclrs = new BigDecimal(0);
            BigDecimal zlglykykclts = new BigDecimal(0);
            BigDecimal zlglykykzsts = new BigDecimal(0);
            BigDecimal zlglykykjtts = new BigDecimal(0);
            BigDecimal zlglykyklwts = new BigDecimal(0);
            BigDecimal zlglykyklwrc = new BigDecimal(0);


            //药品注册审评查验科
            //药品
            BigDecimal ypzcspcykclfyp = new BigDecimal(0);
            BigDecimal ypzcspcyklwfyp = new BigDecimal(0);

            BigDecimal ypzcspcykqysyp = new BigDecimal(0);
            BigDecimal ypzcspcykclrsyp = new BigDecimal(0);
            BigDecimal ypzcspcykcltsyp = new BigDecimal(0);
            BigDecimal ypzcspcykzstsyp = new BigDecimal(0);
            BigDecimal ypzcspcykjttsyp = new BigDecimal(0);
            BigDecimal ypzcspcyklwtsyp = new BigDecimal(0);
            BigDecimal ypzcspcyklwrcyp = new BigDecimal(0);


            //临床
            BigDecimal ypzcspcykclflc = new BigDecimal(0);
            BigDecimal ypzcspcyklwflc = new BigDecimal(0);

            BigDecimal ypzcspcykqyslc = new BigDecimal(0);
            BigDecimal ypzcspcykclrslc = new BigDecimal(0);
            BigDecimal ypzcspcykcltslc = new BigDecimal(0);
            BigDecimal ypzcspcykzstslc = new BigDecimal(0);
            BigDecimal ypzcspcykjttslc = new BigDecimal(0);
            BigDecimal ypzcspcyklwtslc = new BigDecimal(0);
            BigDecimal ypzcspcyklwrclc = new BigDecimal(0);


            //药品生产查验科
            BigDecimal ypsccykclf = new BigDecimal(0);
            BigDecimal ypsccyklwf = new BigDecimal(0);

            BigDecimal ypsccykqys = new BigDecimal(0);
            BigDecimal ypsccykclrs = new BigDecimal(0);
            BigDecimal ypsccykclts = new BigDecimal(0);
            BigDecimal ypsccykzsts = new BigDecimal(0);
            BigDecimal ypsccykjtts = new BigDecimal(0);
            BigDecimal ypsccyklwts = new BigDecimal(0);
            BigDecimal ypsccyklwrc = new BigDecimal(0);

            //药品流通查验科
            BigDecimal ypltcykclf = new BigDecimal(0);
            BigDecimal ypltcyklwf = new BigDecimal(0);

            BigDecimal ypltcykqys = new BigDecimal(0);
            BigDecimal ypltcykclrs = new BigDecimal(0);
            BigDecimal ypltcykclts = new BigDecimal(0);
            BigDecimal ypltcykzsts = new BigDecimal(0);
            BigDecimal ypltcykjtts = new BigDecimal(0);
            BigDecimal ypltcyklwts = new BigDecimal(0);
            BigDecimal ypltcyklwrc = new BigDecimal(0);


            //医疗器械审评查验1科
            BigDecimal ylqxspcykykclf = new BigDecimal(0);
            BigDecimal ylqxspcykyklwf = new BigDecimal(0);

            BigDecimal ylqxspcykykqys = new BigDecimal(0);
            BigDecimal ylqxspcykykclrs = new BigDecimal(0);
            BigDecimal ylqxspcykykclts = new BigDecimal(0);
            BigDecimal ylqxspcykykzsts = new BigDecimal(0);
            BigDecimal ylqxspcykykjtts = new BigDecimal(0);
            BigDecimal ylqxspcykyklwts = new BigDecimal(0);
            BigDecimal ylqxspcykyklwrc = new BigDecimal(0);


            //医疗器械审评查验2科
            BigDecimal ylqxspcykekclf = new BigDecimal(0);
            BigDecimal ylqxspcykeklwf = new BigDecimal(0);

            BigDecimal ylqxspcykekqys = new BigDecimal(0);
            BigDecimal ylqxspcykekclrs = new BigDecimal(0);
            BigDecimal ylqxspcykekclts = new BigDecimal(0);
            BigDecimal ylqxspcykekzsts = new BigDecimal(0);
            BigDecimal ylqxspcykekjtts = new BigDecimal(0);
            BigDecimal ylqxspcykeklwts = new BigDecimal(0);
            BigDecimal ylqxspcykeklwrc = new BigDecimal(0);


            //食品化妆品评审查验科
            BigDecimal sphzpspcykclf = new BigDecimal(0);
            BigDecimal sphzpspcyklwf = new BigDecimal(0);

            BigDecimal sphzpspcykqys = new BigDecimal(0);
            BigDecimal sphzpspcykclrs = new BigDecimal(0);
            BigDecimal sphzpspcykclts = new BigDecimal(0);
            BigDecimal sphzpspcykzsts = new BigDecimal(0);
            BigDecimal sphzpspcykjtts = new BigDecimal(0);
            BigDecimal sphzpspcyklwts = new BigDecimal(0);
            BigDecimal sphzpspcyklwrc = new BigDecimal(0);

            for (NkYssbhj nkYssbhj : nkYssbhjs) {
                BigDecimal fclfhjhValue = new BigDecimal(Optional.ofNullable(nkYssbhj.getFclfhjh()).orElse("0"));
                BigDecimal flwfxjValue = new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfxj()).orElse("0"));

                switch (bm) {
                    case OaFlowConstant.KSMC_BGS:
                        bgsclf = bgsclf.add(fclfhjhValue);
                        bgslwf = bgslwf.add(flwfxjValue);
                        bgsqys = bgsqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        bgsclrs = bgsclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        bgsclts = bgsclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        bgszsts = bgszsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        bgsjtts = bgsjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        bgslwts = bgslwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        bgslwrc = bgslwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    case OaFlowConstant.KSMC_RJK:
                        rjkclf = rjkclf.add(fclfhjhValue);
                        rjklwf = rjklwf.add(flwfxjValue);
                        rjkqys = rjkqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        rjkclrs = rjkclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        rjkclts = rjkclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        rjkzsts = rjkzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        rjkjtts = rjkjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        rjklwts = rjklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        rjklwrc = rjklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    case OaFlowConstant.KSMC_ZLGLYKYK:
                        zlglykykclf = zlglykykclf.add(fclfhjhValue);
                        zlglykyklwf = zlglykyklwf.add(flwfxjValue);
                        zlglykykqys = zlglykykqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        zlglykykclrs = zlglykykclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        zlglykykclts = zlglykykclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        zlglykykzsts = zlglykykzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        zlglykykjtts = zlglykykjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        zlglykyklwts = zlglykyklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        zlglykyklwrc = zlglykyklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));

                        break;
                    case OaFlowConstant.KSMC_YPZCSPCYK:
                        if (nkYssbhj.getFkse().equals(OaFlowConstant.YPZC_YP)) {
                            ypzcspcykclfyp = ypzcspcykclfyp.add(fclfhjhValue);
                            ypzcspcyklwfyp = ypzcspcyklwfyp.add(flwfxjValue);
                            ypzcspcykqysyp = ypzcspcykqysyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                            ypzcspcykclrsyp = ypzcspcykclrsyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                            ypzcspcykcltsyp = ypzcspcykcltsyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                            ypzcspcykzstsyp = ypzcspcykzstsyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                            ypzcspcykjttsyp = ypzcspcykjttsyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                            ypzcspcyklwtsyp = ypzcspcyklwtsyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                            ypzcspcyklwrcyp = ypzcspcyklwrcyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        } else if (nkYssbhj.getFkse().equals(OaFlowConstant.YPZC_LC)) {
                            ypzcspcykclflc = ypzcspcykclflc.add(fclfhjhValue);
                            ypzcspcyklwflc = ypzcspcyklwflc.add(flwfxjValue);
                            ypzcspcykqyslc = ypzcspcykqyslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                            ypzcspcykclrslc = ypzcspcykclrslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                            ypzcspcykcltslc = ypzcspcykcltslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                            ypzcspcykzstslc = ypzcspcykzstslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                            ypzcspcykjttslc = ypzcspcykjttslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                            ypzcspcyklwtslc = ypzcspcyklwtslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                            ypzcspcyklwrclc = ypzcspcyklwrclc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));

                        }
                        break;

                    case OaFlowConstant.KSMC_YPSCCYK:
                        ypsccykclf = ypsccykclf.add(fclfhjhValue);
                        ypsccyklwf = ypsccyklwf.add(flwfxjValue);
                        ypsccykqys = ypsccykqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        ypsccykclrs = ypsccykclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        ypsccykclts = ypsccykclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        ypsccykzsts = ypsccykzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        ypsccykjtts = ypsccykjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        ypsccyklwts = ypsccyklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        ypsccyklwrc = ypsccyklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;

                    case OaFlowConstant.KSMC_YPLTCYK:
                        ypltcykclf = ypltcykclf.add(fclfhjhValue);
                        ypltcyklwf = ypltcyklwf.add(flwfxjValue);
                        ypltcykqys = ypltcykqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        ypltcykclrs = ypltcykclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        ypltcykclts = ypltcykclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        ypltcykzsts = ypltcykzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        ypltcykjtts = ypltcykjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        ypltcyklwts = ypltcyklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        ypltcyklwrc = ypltcyklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    case OaFlowConstant.KSMC_YLQXSPCYK_1:
                        ylqxspcykykclf = ylqxspcykykclf.add(fclfhjhValue);
                        ylqxspcykyklwf = ylqxspcykyklwf.add(flwfxjValue);
                        ylqxspcykykqys = ylqxspcykykqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        ylqxspcykykclrs = ylqxspcykykclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        ylqxspcykykclts = ylqxspcykykclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        ylqxspcykykzsts = ylqxspcykykzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        ylqxspcykykjtts = ylqxspcykykjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        ylqxspcykyklwts = ylqxspcykyklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        ylqxspcykyklwrc = ylqxspcykyklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    case OaFlowConstant.KSMC_YLQXSPCYK_2:
                        ylqxspcykekclf = ylqxspcykekclf.add(fclfhjhValue);
                        ylqxspcykeklwf = ylqxspcykeklwf.add(flwfxjValue);
                        ylqxspcykekqys = ylqxspcykekqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        ylqxspcykekclrs = ylqxspcykekclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        ylqxspcykekclts = ylqxspcykekclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        ylqxspcykekzsts = ylqxspcykekzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        ylqxspcykekjtts = ylqxspcykekjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        ylqxspcykeklwts = ylqxspcykeklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        ylqxspcykeklwrc = ylqxspcykeklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    case OaFlowConstant.KSMC_SPHZPPSCYK:
                        sphzpspcykclf = sphzpspcykclf.add(fclfhjhValue);
                        sphzpspcyklwf = sphzpspcyklwf.add(flwfxjValue);
                        sphzpspcykqys = sphzpspcykqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        sphzpspcykclrs = sphzpspcykclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        sphzpspcykclts = sphzpspcykclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        sphzpspcykzsts = sphzpspcykzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        sphzpspcykjtts = sphzpspcykjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        sphzpspcyklwts = sphzpspcyklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        sphzpspcyklwrc = sphzpspcyklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    default:
                        // 处理其他情况或无需处理
                        break;
                }
            }
            bgshj.put("name", "办公室");
            bgshj.put("clf", bgsclf);
            bgshj.put("lwf", bgslwf);
            bgshj.put("qys", bgsqys);
            bgshj.put("clrs", bgsclrs);
            bgshj.put("clts", bgsclts);
            bgshj.put("zsts", bgszsts);
            bgshj.put("jtts", bgsjtts);
            bgshj.put("lwts", bgslwts);
            bgshj.put("lwrc", bgslwrc);


            //人教科
            rjkhj.put("name", "人教科");
            rjkhj.put("clf", rjkclf);
            rjkhj.put("lwf", rjklwf);
            rjkhj.put("qys", rjkqys);
            rjkhj.put("clrs", rjkclrs);
            rjkhj.put("clts", rjkclts);
            rjkhj.put("zsts", rjkzsts);
            rjkhj.put("jtts", rjkjtts);
            rjkhj.put("lwts", rjklwts);
            rjkhj.put("lwrc", rjklwrc);

            //质量管理与科研科
            zlglykykhj.put("name", "质量管理与科研科");
            zlglykykhj.put("clf", zlglykykclf);
            zlglykykhj.put("lwf", zlglykyklwf);
            zlglykykhj.put("qys", zlglykykqys);
            zlglykykhj.put("clrs", zlglykykclrs);
            zlglykykhj.put("clts", zlglykykclts);
            zlglykykhj.put("zsts", zlglykykzsts);
            zlglykykhj.put("jtts", zlglykykjtts);
            zlglykykhj.put("lwts", zlglykyklwts);
            zlglykykhj.put("lwrc", zlglykyklwrc);


            //药品注册审评查验科合计
            HashMap ypzcspcykhj = new HashMap();
            ypzcspcykhj.put("name", "药品注册审评查验科");
            ypzcspcykhj.put("clf", ypzcspcykclfyp.add(ypzcspcykclflc));
            ypzcspcykhj.put("lwf", ypzcspcyklwfyp.add(ypzcspcyklwflc));
            ypzcspcykhj.put("qys", ypzcspcykqysyp.add(ypzcspcykqyslc));
            ypzcspcykhj.put("clrs", ypzcspcykclrsyp.add(ypzcspcykclrslc));
            ypzcspcykhj.put("clts", ypzcspcykcltsyp.add(ypzcspcykcltslc));
            ypzcspcykhj.put("zsts", ypzcspcykzstsyp.add(ypzcspcykzstslc));
            ypzcspcykhj.put("jtts", ypzcspcykjttsyp.add(ypzcspcykjttslc));
            ypzcspcykhj.put("lwts", ypzcspcyklwtsyp.add(ypzcspcyklwtslc));
            ypzcspcykhj.put("lwrc", ypzcspcyklwrcyp.add(ypzcspcyklwrclc));

            List yplist = new ArrayList<>();

            //药品注册审评查验科 药品
            ypzcspcykclfhjyp.put("name", "药品");
            ypzcspcykclfhjyp.put("clf", ypzcspcykclfyp);
            ypzcspcykclfhjyp.put("lwf", ypzcspcyklwfyp);
            ypzcspcykclfhjyp.put("qys", ypzcspcykqysyp);
            ypzcspcykclfhjyp.put("clrs", ypzcspcykclrsyp);
            ypzcspcykclfhjyp.put("clts", ypzcspcykcltsyp);
            ypzcspcykclfhjyp.put("zsts", ypzcspcykzstsyp);
            ypzcspcykclfhjyp.put("jtts", ypzcspcykjttsyp);
            ypzcspcykclfhjyp.put("lwts", ypzcspcyklwtsyp);
            ypzcspcykclfhjyp.put("lwrc", ypzcspcyklwrcyp);

            //药品注册审评查验科 临床
            ypzcspcykclfhjlc.put("name", "临床");
            ypzcspcykclfhjlc.put("clf", ypzcspcykclflc);
            ypzcspcykclfhjlc.put("lwf", ypzcspcyklwflc);
            ypzcspcykclfhjlc.put("qys", ypzcspcykqyslc);
            ypzcspcykclfhjlc.put("clrs", ypzcspcykclrslc);
            ypzcspcykclfhjlc.put("clts", ypzcspcykcltslc);
            ypzcspcykclfhjlc.put("zsts", ypzcspcykzstslc);
            ypzcspcykclfhjlc.put("jtts", ypzcspcykjttslc);
            ypzcspcykclfhjlc.put("lwts", ypzcspcyklwtslc);
            ypzcspcykclfhjlc.put("lwrc", ypzcspcyklwrclc);


            yplist.add(ypzcspcykclfhjyp);
            yplist.add(ypzcspcykclfhjlc);


            ypzcspcykhj.put("list", yplist);


            //药品生产查验科
            ypsccykhj.put("name", "药品生产查验科");
            ypsccykhj.put("clf", ypsccykclf);
            ypsccykhj.put("lwf", ypsccyklwf);
            ypsccykhj.put("qys", ypsccykqys);
            ypsccykhj.put("clrs", ypsccykclrs);
            ypsccykhj.put("clts", ypsccykclts);
            ypsccykhj.put("zsts", ypsccykzsts);
            ypsccykhj.put("jtts", ypsccykjtts);
            ypsccykhj.put("lwts", ypsccyklwts);
            ypsccykhj.put("lwrc", ypsccyklwrc);
            //药品流通查验科
            ypltcykhj.put("name", "药品流通查验科");
            ypltcykhj.put("clf", ypltcykclf);
            ypltcykhj.put("lwf", ypltcyklwf);
            ypltcykhj.put("qys", ypltcykqys);
            ypltcykhj.put("clrs", ypltcykclrs);
            ypltcykhj.put("clts", ypltcykclts);
            ypltcykhj.put("zsts", ypltcykzsts);
            ypltcykhj.put("jtts", ypltcykjtts);
            ypltcykhj.put("lwts", ypltcyklwts);
            ypltcykhj.put("lwrc", ypltcyklwrc);
            //医疗器械审评查验1科
            ylqxspcykykhj.put("name", "医疗器械审评查验1科");
            ylqxspcykykhj.put("clf", ylqxspcykykclf);
            ylqxspcykykhj.put("lwf", ylqxspcykyklwf);
            ylqxspcykykhj.put("qys", ylqxspcykykqys);
            ylqxspcykykhj.put("clrs", ylqxspcykykclrs);
            ylqxspcykykhj.put("clts", ylqxspcykykclts);
            ylqxspcykykhj.put("zsts", ylqxspcykykzsts);
            ylqxspcykykhj.put("jtts", ylqxspcykykjtts);
            ylqxspcykykhj.put("lwts", ylqxspcykyklwts);
            ylqxspcykykhj.put("lwrc", ylqxspcykyklwrc);
            //医疗器械审评查验2科
            ylqxspcykekhj.put("name", "医疗器械审评查验2科");
            ylqxspcykekhj.put("clf", ylqxspcykekclf);
            ylqxspcykekhj.put("lwf", ylqxspcykeklwf);
            ylqxspcykekhj.put("qys", ylqxspcykekqys);
            ylqxspcykekhj.put("clrs", ylqxspcykekclrs);
            ylqxspcykekhj.put("clts", ylqxspcykekclts);
            ylqxspcykekhj.put("zsts", ylqxspcykekzsts);
            ylqxspcykekhj.put("jtts", ylqxspcykekjtts);
            ylqxspcykekhj.put("lwts", ylqxspcykeklwts);
            ylqxspcykekhj.put("lwrc", ylqxspcykeklwrc);
            //食品化妆品评审查验科
            sphzpspcykhj.put("name", "食品化妆品评审查验科");
            sphzpspcykhj.put("clf", sphzpspcykclf);
            sphzpspcykhj.put("lwf", sphzpspcyklwf);
            sphzpspcykhj.put("qys", sphzpspcykqys);
            sphzpspcykhj.put("clrs", sphzpspcykclrs);
            sphzpspcykhj.put("clts", sphzpspcykclts);
            sphzpspcykhj.put("zsts", sphzpspcykzsts);
            sphzpspcykhj.put("jtts", sphzpspcykjtts);
            sphzpspcykhj.put("lwts", sphzpspcyklwts);
            sphzpspcykhj.put("lwrc", sphzpspcyklwrc);

            //总计
            HashMap zjmap = new HashMap();
            zjmap.put("name", "总计");
            zjmap.put("clf", bgsclf.add(rjkclf).add(zlglykykclf).add(ypzcspcykclfyp).add(ypzcspcykclflc)
                    .add(ypsccykclf).add(ypltcykclf).add(ylqxspcykykclf).add(ylqxspcykekclf).add(sphzpspcykclf));
            zjmap.put("lwf", bgslwf.add(rjklwf).add(zlglykyklwf).add(ypzcspcyklwfyp).add(ypzcspcyklwflc)
                    .add(ypsccyklwf).add(ypltcyklwf).add(ylqxspcykyklwf).add(ylqxspcykeklwf).add(sphzpspcyklwf));
            zjmap.put("qys", bgsqys.add(rjkqys).add(zlglykykqys).add(ypzcspcykqysyp).add(ypzcspcykqyslc)
                    .add(ypsccykqys).add(ypltcykqys).add(ylqxspcykykqys).add(ylqxspcykekqys).add(sphzpspcykqys));
            zjmap.put("clrs", bgsclrs.add(rjkclrs).add(zlglykykclrs).add(ypzcspcykclrsyp).add(ypzcspcykclrslc)
                    .add(ypsccykclrs).add(ypltcykclrs).add(ylqxspcykykclrs).add(ylqxspcykekclrs).add(sphzpspcykclrs));
            zjmap.put("clts", bgsclts.add(rjkclts).add(zlglykykclts).add(ypzcspcykcltsyp).add(ypzcspcykcltslc)
                    .add(ypsccykclts).add(ypltcykclts).add(ylqxspcykykclts).add(ylqxspcykekclts).add(sphzpspcykclts));
            zjmap.put("zsts", bgszsts.add(rjkzsts).add(zlglykykzsts).add(ypzcspcykzstsyp).add(ypzcspcykzstslc)
                    .add(ypsccykzsts).add(ypltcykzsts).add(ylqxspcykykzsts).add(ylqxspcykekzsts).add(sphzpspcykzsts));
            zjmap.put("jtts", bgsjtts.add(rjkjtts).add(zlglykykjtts).add(ypzcspcykjttsyp).add(ypzcspcykjttslc)
                    .add(ypsccykjtts).add(ypltcykjtts).add(ylqxspcykykjtts).add(ylqxspcykekjtts).add(sphzpspcykjtts));
            zjmap.put("lwts", bgslwts.add(rjklwts).add(zlglykyklwts).add(ypzcspcyklwtsyp).add(ypzcspcyklwtslc)
                    .add(ypsccyklwts).add(ypltcyklwts).add(ylqxspcykyklwts).add(ylqxspcykeklwts).add(sphzpspcyklwts));
            zjmap.put("lwrc", bgslwrc.add(rjklwrc).add(zlglykyklwrc).add(ypzcspcyklwrcyp).add(ypzcspcyklwrclc)
                    .add(ypsccyklwrc).add(ypltcyklwrc).add(ylqxspcykyklwrc).add(ylqxspcykeklwrc).add(sphzpspcyklwrc));


            List allList = new ArrayList<>();
            allList.add(bgshj);
            allList.add(rjkhj);
            allList.add(zlglykykhj);

            allList.add(ypzcspcykhj);
            allList.add(ypsccykhj);
            allList.add(ypltcykhj);
            allList.add(ylqxspcykykhj);
            allList.add(ylqxspcykekhj);
            allList.add(sphzpspcykhj);
            allList.add(zjmap);
            return allList;
        }

        if (jclx.equals(OaCommonFlowConstant.XMNR_KT)) {
            //办公室
            Map bgshj = new HashMap<>();
            //人教科
            Map rjkhj = new HashMap<>();
            //质量管理与科研科
            Map zlglykykhj = new HashMap<>();

            HashMap ypzcspcykhj = new HashMap();
            //药品生产查验科
            Map ypsccykhj = new HashMap<>();
            //药品流通查验科
            Map ypltcykhj = new HashMap<>();
            //医疗器械审评查验1科
            Map ylqxspcykykhj = new HashMap<>();
            //医疗器械审评查验2科
            Map ylqxspcykekhj = new HashMap<>();
            //食品化妆品评审查验科
            Map sphzpspcykhj = new HashMap<>();

            //通过计划id，可以直接拿到预算表本计划的汇总
            List<NkYssbhjKt> nkYssbhjKts = nkYssbhjKtService.list(new LambdaQueryWrapper<NkYssbhjKt>()
                    .eq(NkYssbhjKt::getFyssbjhid, jhid)
                    .eq(NkYssbhjKt::getFlx, OaCommonFlowConstant.HZBD_HZ)
                    .eq(NkYssbhjKt::getFktfzks, bm));

            //各个部门的数据集合
            //办公室
            BigDecimal bgsclf = new BigDecimal(0);

            //人教科
            BigDecimal rjkclf = new BigDecimal(0);

            //质量管理与科研科
            BigDecimal zlglykykclf = new BigDecimal(0);

            //药品注册审评查验科
            BigDecimal ypzcspcykclf = new BigDecimal(0);


            //药品生产查验科
            BigDecimal ypsccykclf = new BigDecimal(0);

            //药品流通查验科
            BigDecimal ypltcykclf = new BigDecimal(0);

            //医疗器械审评查验1科
            BigDecimal ylqxspcykykclf = new BigDecimal(0);

            //医疗器械审评查验2科
            BigDecimal ylqxspcykekclf = new BigDecimal(0);

            //食品化妆品评审查验科
            BigDecimal sphzpspcykclf = new BigDecimal(0);


            for (NkYssbhjKt nkYssbhjKt : nkYssbhjKts) {
                BigDecimal fktjf = new BigDecimal(Optional.ofNullable(nkYssbhjKt.getFktjf()).orElse("0"));


                switch (bm) {
                    case OaFlowConstant.KSMC_BGS:
                        bgsclf = bgsclf.add(fktjf);
                        break;
                    case OaFlowConstant.KSMC_RJK:
                        rjkclf = rjkclf.add(fktjf);
                        break;
                    case OaFlowConstant.KSMC_ZLGLYKYK:
                        zlglykykclf = zlglykykclf.add(fktjf);
                        break;
                    case OaFlowConstant.KSMC_YPZCSPCYK:
                        ypzcspcykclf = ypzcspcykclf.add(fktjf);
                        break;

                    case OaFlowConstant.KSMC_YPSCCYK:
                        ypsccykclf = ypsccykclf.add(fktjf);
                        break;
                    case OaFlowConstant.KSMC_YPLTCYK:
                        ypltcykclf = ypltcykclf.add(fktjf);
                        break;
                    case OaFlowConstant.KSMC_YLQXSPCYK_1:
                        ylqxspcykykclf = ylqxspcykykclf.add(fktjf);
                        break;
                    case OaFlowConstant.KSMC_YLQXSPCYK_2:
                        ylqxspcykekclf = ylqxspcykekclf.add(fktjf);
                        break;
                    case OaFlowConstant.KSMC_SPHZPPSCYK:
                        sphzpspcykclf = sphzpspcykclf.add(fktjf);
                        break;
                    default:
                        // 处理其他情况或无需处理
                        break;
                }
            }
            bgshj.put("name", "办公室");
            bgshj.put("ktjf", bgsclf);

            //人教科
            rjkhj.put("name", "人教科");
            rjkhj.put("ktjf", rjkclf);


            //质量管理与科研科
            zlglykykhj.put("name", "质量管理与科研科");
            zlglykykhj.put("ktjf", zlglykykclf);

            //药品注册审评查验科合计
            ypzcspcykhj.put("name", "药品注册审评查验科");
            ypzcspcykhj.put("ktjf", ypzcspcykclf);


            //药品生产查验科
            ypsccykhj.put("name", "药品生产查验科");
            ypsccykhj.put("ktjf", ypsccykclf);

            //药品流通查验科
            ypltcykhj.put("name", "药品流通查验科");
            ypltcykhj.put("ktjf", ypltcykclf);

            //医疗器械审评查验1科
            ylqxspcykykhj.put("name", "医疗器械审评查验1科");
            ylqxspcykykhj.put("ktjf", ylqxspcykykclf);

            //医疗器械审评查验2科
            ylqxspcykekhj.put("name", "医疗器械审评查验2科");
            ylqxspcykekhj.put("ktjf", ylqxspcykekclf);

            //食品化妆品评审查验科
            sphzpspcykhj.put("name", "食品化妆品评审查验科");
            sphzpspcykhj.put("ktjf", sphzpspcykclf);


            //总计
            HashMap zjmap = new HashMap();
            zjmap.put("name", "总计");
            zjmap.put("ktjf", bgsclf.add(rjkclf).add(zlglykykclf).add(ypzcspcykclf)
                    .add(ypsccykclf).add(ypltcykclf).add(ylqxspcykykclf).add(ylqxspcykekclf).add(sphzpspcykclf));


            List allList = new ArrayList<>();
            allList.add(bgshj);
            allList.add(rjkhj);
            allList.add(zlglykykhj);

            allList.add(ypzcspcykhj);
            allList.add(ypsccykhj);
            allList.add(ypltcykhj);
            allList.add(ylqxspcykykhj);
            allList.add(ylqxspcykekhj);
            allList.add(sphzpspcykhj);
            allList.add(zjmap);
            return allList;
        }

        if (jclx.equals(OaCommonFlowConstant.XMNR_YS)) {
            //办公室
            Map bgshj = new HashMap<>();
            //人教科
            Map rjkhj = new HashMap<>();
            //质量管理与科研科
            Map zlglykykhj = new HashMap<>();

            HashMap ypzcspcykhj = new HashMap();
            //药品生产查验科
            Map ypsccykhj = new HashMap<>();
            //药品流通查验科
            Map ypltcykhj = new HashMap<>();
            //医疗器械审评查验1科
            Map ylqxspcykykhj = new HashMap<>();
            //医疗器械审评查验2科
            Map ylqxspcykekhj = new HashMap<>();
            //食品化妆品评审查验科
            Map sphzpspcykhj = new HashMap<>();

            //通过计划id，可以直接拿到预算表本计划的汇总
            List<NkYssbhjys> nkYssbhjys = nkYssbhjysService.list(new LambdaQueryWrapper<NkYssbhjys>()
                    .eq(NkYssbhjys::getFyssbjhid, jhid)
                    .eq(NkYssbhjys::getFlx, OaCommonFlowConstant.HZBD_HZ)
                    .eq(NkYssbhjys::getFks, bm));

            //各个部门的数据集合
            //办公室
            BigDecimal bgsclf = new BigDecimal(0);

            //人教科
            BigDecimal rjkclf = new BigDecimal(0);

            //质量管理与科研科
            BigDecimal zlglykykclf = new BigDecimal(0);

            //药品注册审评查验科
            BigDecimal ypzcspcykclf = new BigDecimal(0);


            //药品生产查验科
            BigDecimal ypsccykclf = new BigDecimal(0);

            //药品流通查验科
            BigDecimal ypltcykclf = new BigDecimal(0);

            //医疗器械审评查验1科
            BigDecimal ylqxspcykykclf = new BigDecimal(0);

            //医疗器械审评查验2科
            BigDecimal ylqxspcykekclf = new BigDecimal(0);

            //食品化妆品评审查验科
            BigDecimal sphzpspcykclf = new BigDecimal(0);


            for (NkYssbhjys nkYssbhjys1 : nkYssbhjys) {
                BigDecimal fysf = new BigDecimal(Optional.ofNullable(nkYssbhjys1.getFyzhj()).orElse("0"));


                switch (bm) {
                    case OaFlowConstant.KSMC_BGS:
                        bgsclf = bgsclf.add(fysf);
                        break;
                    case OaFlowConstant.KSMC_RJK:
                        rjkclf = rjkclf.add(fysf);
                        break;
                    case OaFlowConstant.KSMC_ZLGLYKYK:
                        zlglykykclf = zlglykykclf.add(fysf);
                        break;
                    case OaFlowConstant.KSMC_YPZCSPCYK:
                        ypzcspcykclf = ypzcspcykclf.add(fysf);
                        break;
                    case OaFlowConstant.KSMC_YPSCCYK:
                        ypsccykclf = ypsccykclf.add(fysf);
                        break;
                    case OaFlowConstant.KSMC_YPLTCYK:
                        ypltcykclf = ypltcykclf.add(fysf);
                        break;
                    case OaFlowConstant.KSMC_YLQXSPCYK_1:
                        ylqxspcykykclf = ylqxspcykykclf.add(fysf);
                        break;
                    case OaFlowConstant.KSMC_YLQXSPCYK_2:
                        ylqxspcykekclf = ylqxspcykekclf.add(fysf);
                        break;
                    case OaFlowConstant.KSMC_SPHZPPSCYK:
                        sphzpspcykclf = sphzpspcykclf.add(fysf);
                        break;
                    default:
                        // 处理其他情况或无需处理
                        break;
                }
            }
            bgshj.put("name", "办公室");
            bgshj.put("ysf", bgsclf);

            //人教科
            rjkhj.put("name", "人教科");
            rjkhj.put("ysf", rjkclf);


            //质量管理与科研科
            zlglykykhj.put("name", "质量管理与科研科");
            zlglykykhj.put("ysf", zlglykykclf);

            //药品注册审评查验科合计
            ypzcspcykhj.put("name", "药品注册审评查验科");
            ypzcspcykhj.put("ysf", ypzcspcykclf);


            //药品生产查验科
            ypsccykhj.put("name", "药品生产查验科");
            ypsccykhj.put("ysf", ypsccykclf);

            //药品流通查验科
            ypltcykhj.put("name", "药品流通查验科");
            ypltcykhj.put("ysf", ypltcykclf);

            //医疗器械审评查验1科
            ylqxspcykykhj.put("name", "医疗器械审评查验1科");
            ylqxspcykykhj.put("ysf", ylqxspcykykclf);

            //医疗器械审评查验2科
            ylqxspcykekhj.put("name", "医疗器械审评查验2科");
            ylqxspcykekhj.put("ysf", ylqxspcykekclf);

            //食品化妆品评审查验科
            sphzpspcykhj.put("name", "食品化妆品评审查验科");
            sphzpspcykhj.put("ysf", sphzpspcykclf);


            //总计
            HashMap zjmap = new HashMap();
            zjmap.put("name", "总计");
            zjmap.put("ysf", bgsclf.add(rjkclf).add(zlglykykclf).add(ypzcspcykclf)
                    .add(ypsccykclf).add(ypltcykclf).add(ylqxspcykykclf).add(ylqxspcykekclf).add(sphzpspcykclf));


            List allList = new ArrayList<>();
            allList.add(bgshj);
            allList.add(rjkhj);
            allList.add(zlglykykhj);

            allList.add(ypzcspcykhj);
            allList.add(ypsccykhj);
            allList.add(ypltcykhj);
            allList.add(ylqxspcykykhj);
            allList.add(ylqxspcykekhj);
            allList.add(sphzpspcykhj);
            allList.add(zjmap);
            return allList;
        }

        if (jclx.equals(OaCommonFlowConstant.XMNR_PX)) {
            //办公室
            Map bgshj = new HashMap<>();
            //人教科
            Map rjkhj = new HashMap<>();
            //质量管理与科研科
            Map zlglykykhj = new HashMap<>();

            HashMap ypzcspcykhj = new HashMap();
            //药品生产查验科
            Map ypsccykhj = new HashMap<>();
            //药品流通查验科
            Map ypltcykhj = new HashMap<>();
            //医疗器械审评查验1科
            Map ylqxspcykykhj = new HashMap<>();
            //医疗器械审评查验2科
            Map ylqxspcykekhj = new HashMap<>();
            //食品化妆品评审查验科
            Map sphzpspcykhj = new HashMap<>();

            //通过计划id，可以直接拿到预算表本计划的汇总
            List<NkYssbhjPx> nkYssbhjPX = nkYssbhjpxService.list(new LambdaQueryWrapper<NkYssbhjPx>()
                    .eq(NkYssbhjPx::getFyssbjhid, jhid)
                    .eq(NkYssbhjPx::getFlx, OaCommonFlowConstant.HZBD_HZ)
                    .eq(NkYssbhjPx::getFks, bm));

            //各个部门的数据集合
            //办公室
            //培训人数 培训费 师资小计 合计
            BigDecimal bgspxrs = new BigDecimal(0);
            BigDecimal bgspxf = new BigDecimal(0);
            BigDecimal bgsszxj = new BigDecimal(0);
            BigDecimal bgspxhj = new BigDecimal(0);


            //人教科
            BigDecimal rjkpxrs = new BigDecimal(0);
            BigDecimal rjkpxf = new BigDecimal(0);
            BigDecimal rjkszxj = new BigDecimal(0);
            BigDecimal rjkszxjhj = new BigDecimal(0);

            //质量管理与科研科
            BigDecimal zlglykykpxrs = new BigDecimal(0);
            BigDecimal zlglykykpxf = new BigDecimal(0);
            BigDecimal zlglykykpxzxj = new BigDecimal(0);
            BigDecimal zlglykykpxzxjhj = new BigDecimal(0);


            //药品注册审评查验科
            BigDecimal ypzcspcykpxrs = new BigDecimal(0);
            BigDecimal ypzcspcykpxf = new BigDecimal(0);
            BigDecimal ypzcspcykpxzxj = new BigDecimal(0);
            BigDecimal ypzcspcykpxzxjhj = new BigDecimal(0);


            //药品生产查验科
            BigDecimal ypsccykpxrs = new BigDecimal(0);
            BigDecimal ypsccykpxf = new BigDecimal(0);
            BigDecimal ypsccykpxzxj = new BigDecimal(0);
            BigDecimal ypsccykpxzxjhj = new BigDecimal(0);

            //药品流通查验科
            BigDecimal ypltcykcpxrs = new BigDecimal(0);
            BigDecimal ypltcykcpxf = new BigDecimal(0);
            BigDecimal ypltcykcpxzxj = new BigDecimal(0);
            BigDecimal ypltcykcpxzxjhj = new BigDecimal(0);

            //医疗器械审评查验1科
            BigDecimal ylqxspcykykpxrs = new BigDecimal(0);
            BigDecimal ylqxspcykykpxf = new BigDecimal(0);
            BigDecimal ylqxspcykykpxzxj = new BigDecimal(0);
            BigDecimal ylqxspcykykpxzxjhj = new BigDecimal(0);

            //医疗器械审评查验2科
            BigDecimal ylqxspcykekpxrs = new BigDecimal(0);
            BigDecimal ylqxspcykekpxf = new BigDecimal(0);
            BigDecimal ylqxspcykekpxzxj = new BigDecimal(0);
            BigDecimal ylqxspcykekpxzxjhj = new BigDecimal(0);

            //食品化妆品评审查验科
            BigDecimal sphzpspcykpxrs = new BigDecimal(0);
            BigDecimal sphzpspcykpxf = new BigDecimal(0);
            BigDecimal sphzpspcykpxzxj = new BigDecimal(0);
            BigDecimal sphzpspcykpxzxjhj = new BigDecimal(0);


            for (NkYssbhjPx nkYssbhjys1 : nkYssbhjPX) {
                BigDecimal fpxrs = new BigDecimal(Optional.ofNullable(nkYssbhjys1.getFpxrs()).orElse("0"));
                BigDecimal fpxfy = new BigDecimal(Optional.ofNullable(nkYssbhjys1.getFpxfy()).orElse("0"));
                BigDecimal fskf = new BigDecimal(Optional.ofNullable(nkYssbhjys1.getFskf()).orElse("0"));
                BigDecimal fpxskxj = new BigDecimal(Optional.ofNullable(nkYssbhjys1.getFpxskxj()).orElse("0"));


                switch (bm) {
                    case OaFlowConstant.KSMC_BGS:
                        bgspxrs = bgspxrs.add(fpxrs);
                        bgspxf = bgspxf.add(fpxfy);
                        bgsszxj = bgsszxj.add(fskf);
                        bgspxhj = bgspxhj.add(fpxskxj);
                        break;
                    case OaFlowConstant.KSMC_RJK:
                        rjkpxrs = rjkpxrs.add(fpxrs);
                        rjkpxf = rjkpxf.add(fpxfy);
                        rjkszxj = rjkszxj.add(fskf);
                        rjkszxjhj = rjkszxjhj.add(fpxskxj);

                        break;
                    case OaFlowConstant.KSMC_ZLGLYKYK:
                        zlglykykpxrs = zlglykykpxrs.add(fpxrs);
                        zlglykykpxf = zlglykykpxf.add(fpxfy);
                        zlglykykpxzxj = zlglykykpxzxj.add(fskf);
                        zlglykykpxzxjhj = zlglykykpxzxjhj.add(fpxskxj);

                        break;
                    case OaFlowConstant.KSMC_YPZCSPCYK:
                        ypzcspcykpxrs = ypzcspcykpxrs.add(fpxrs);
                        ypzcspcykpxf = ypzcspcykpxf.add(fpxfy);
                        ypzcspcykpxzxj = ypzcspcykpxzxj.add(fskf);
                        ypzcspcykpxzxjhj = ypzcspcykpxzxjhj.add(fpxskxj);


                        break;
                    case OaFlowConstant.KSMC_YPSCCYK:
                        ypsccykpxrs = ypsccykpxrs.add(fpxrs);
                        ypsccykpxf = ypsccykpxf.add(fpxfy);
                        ypsccykpxzxj = ypsccykpxzxj.add(fskf);
                        ypsccykpxzxjhj = ypsccykpxzxjhj.add(fpxskxj);

                        break;
                    case OaFlowConstant.KSMC_YPLTCYK:
                        ypltcykcpxrs = ypltcykcpxrs.add(fpxrs);
                        ypltcykcpxf = ypltcykcpxf.add(fpxfy);
                        ypltcykcpxzxj = ypltcykcpxzxj.add(fskf);
                        ypltcykcpxzxjhj = ypltcykcpxzxjhj.add(fpxskxj);

                        break;
                    case OaFlowConstant.KSMC_YLQXSPCYK_1:
                        ylqxspcykykpxrs = ylqxspcykykpxrs.add(fpxrs);
                        ylqxspcykykpxf = ylqxspcykykpxf.add(fpxfy);
                        ylqxspcykykpxzxj = ylqxspcykykpxzxj.add(fskf);
                        ylqxspcykykpxzxjhj = ylqxspcykykpxzxjhj.add(fpxskxj);

                        break;
                    case OaFlowConstant.KSMC_YLQXSPCYK_2:
                        ylqxspcykekpxrs = ylqxspcykekpxrs.add(fpxrs);
                        ylqxspcykekpxf = ylqxspcykekpxf.add(fpxfy);
                        ylqxspcykekpxzxj = ylqxspcykekpxzxj.add(fskf);
                        ylqxspcykekpxzxjhj = ylqxspcykekpxzxjhj.add(fpxskxj);

                        break;
                    case OaFlowConstant.KSMC_SPHZPPSCYK:
                        sphzpspcykpxrs = sphzpspcykpxrs.add(fpxrs);
                        sphzpspcykpxf = sphzpspcykpxf.add(fpxfy);
                        sphzpspcykpxzxj = sphzpspcykpxzxj.add(fskf);
                        sphzpspcykpxzxjhj = sphzpspcykpxzxjhj.add(fpxskxj);

                        break;
                    default:
                        // 处理其他情况或无需处理
                        break;
                }
            }
            bgshj.put("name", "办公室");
            bgshj.put("pxrs", bgspxrs);
            bgshj.put("pxf", bgspxf);
            bgshj.put("szfy", bgsszxj);
            bgshj.put("pxhj", bgspxhj);

            //人教科
            rjkhj.put("name", "人教科");
            rjkhj.put("pxrs", rjkpxrs);
            rjkhj.put("pxf", rjkpxf);
            rjkhj.put("szfy", rjkszxj);
            rjkhj.put("pxhj", rjkszxjhj);


            //质量管理与科研科
            zlglykykhj.put("name", "质量管理与科研科");
            zlglykykhj.put("pxrs", zlglykykpxrs);
            zlglykykhj.put("pxf", zlglykykpxf);
            zlglykykhj.put("szfy", zlglykykpxzxj);
            zlglykykhj.put("pxhj", zlglykykpxzxjhj);


            //药品注册审评查验科合计
            ypzcspcykhj.put("name", "药品注册审评查验科");
            ypzcspcykhj.put("pxrs", ypzcspcykpxrs);
            ypzcspcykhj.put("pxf", ypzcspcykpxf);
            ypzcspcykhj.put("szfy", ypzcspcykpxzxj);
            ypzcspcykhj.put("pxhj", ypzcspcykpxzxjhj);


            //药品生产查验科
            ypsccykhj.put("name", "药品生产查验科");
            ypsccykhj.put("pxrs", ypsccykpxrs);
            ypsccykhj.put("pxf", ypsccykpxf);
            ypsccykhj.put("szfy", ypsccykpxzxj);
            ypsccykhj.put("pxhj", ypsccykpxzxjhj);


            //药品流通查验科
            ypltcykhj.put("name", "药品流通查验科");
            ypltcykhj.put("pxrs", ypltcykcpxrs);
            ypltcykhj.put("pxf", ypltcykcpxf);
            ypltcykhj.put("szfy", ypltcykcpxzxj);
            ypltcykhj.put("pxhj", ypltcykcpxzxjhj);


            //医疗器械审评查验1科
            ylqxspcykykhj.put("name", "医疗器械审评查验1科");
            ylqxspcykykhj.put("pxrs", ylqxspcykykpxrs);
            ylqxspcykykhj.put("pxf", ylqxspcykekpxf);
            ylqxspcykykhj.put("szfy", ylqxspcykykpxzxj);
            ylqxspcykekhj.put("pxhj", ylqxspcykekpxzxjhj);


            //医疗器械审评查验2科
            ylqxspcykekhj.put("name", "医疗器械审评查验2科");
            ylqxspcykekhj.put("pxrs", ylqxspcykekpxrs);
            ylqxspcykekhj.put("pxf", ylqxspcykekpxf);
            ylqxspcykekhj.put("szfy", ylqxspcykekpxzxj);
            ylqxspcykekhj.put("pxhj", ylqxspcykekpxzxjhj);


            //食品化妆品评审查验科
            sphzpspcykhj.put("name", "食品化妆品评审查验科");
            sphzpspcykhj.put("pxrs", sphzpspcykpxrs);
            sphzpspcykhj.put("pxf", sphzpspcykpxf);
            sphzpspcykhj.put("szfy", sphzpspcykpxzxj);
            sphzpspcykhj.put("pxhj", sphzpspcykpxzxjhj);


            //总计
            HashMap zjmap = new HashMap();
            zjmap.put("name", "总计");
            zjmap.put("pxrs", bgspxrs.add(rjkpxrs).add(zlglykykpxrs).add(ypzcspcykpxrs).add(ypsccykpxrs)
                    .add(ypltcykcpxrs).add(ylqxspcykykpxrs).add(ylqxspcykekpxrs).add(sphzpspcykpxrs));
            zjmap.put("pxf", bgspxf.add(rjkpxf).add(zlglykykpxf).add(ypzcspcykpxf).add(ypsccykpxf)
                    .add(ypltcykcpxf).add(ylqxspcykykpxf).add(ylqxspcykekpxf).add(sphzpspcykpxf));
            zjmap.put("szfy", bgsszxj.add(rjkszxj).add(zlglykykpxzxj).add(ypzcspcykpxzxj).add(ypsccykpxzxj)
                    .add(ypltcykcpxzxj).add(ylqxspcykykpxzxj).add(ylqxspcykekpxzxj).add(sphzpspcykpxzxj));
            zjmap.put("pxhj", bgspxhj.add(rjkszxjhj).add(zlglykykpxzxjhj).add(ypzcspcykpxzxjhj).add(ypsccykpxzxjhj)
                    .add(ypltcykcpxzxjhj).add(ylqxspcykykpxzxjhj).add(ylqxspcykekpxzxjhj).add(sphzpspcykpxzxjhj));


            List allList = new ArrayList<>();
            allList.add(bgshj);
            allList.add(rjkhj);
            allList.add(zlglykykhj);

            allList.add(ypzcspcykhj);
            allList.add(ypsccykhj);
            allList.add(ypltcykhj);
            allList.add(ylqxspcykykhj);
            allList.add(ylqxspcykekhj);
            allList.add(sphzpspcykhj);
            allList.add(zjmap);
            return allList;
        }

        return null;
    }






}

